string.join and string.split

void main (){
 var x="gutentag";
 var x2=x.split("t");
 foreach (var s in x2) print ("%s ",s);


gu en ag 3
[Invalid UTF-8] \xe07\xd7\x08\xf07\xd7\x08@(\xd7\x08

Why the last line says invalid UTF8 blah blah blah? It's junk, it's reading raw memory. Why? It probably has something to do with string.join() accepting (...) as a parameter while string.joinv() accepts an array of values.

Vala's string.split, string.join, and string.joinv come from the glib library's g_strsplit, g_strjoin, and g_strjoinv functions.

You can look up the vala VAPI interface to them here:

You can see the glib C description of them here:

Projects/Vala/User:Decora/string.split and string.join (last edited 2013-11-22 16:48:28 by WilliamJonMcCann)