Example: Replace any delimiter characters with another one (inline)

public static int main (string[] args) {
string str1 = "ABCDEFG";
unowned string str2 = str1._delimit ("ADEG", 'x');

// Output:
// ``xBCxxFx``
// ``xBCxxFx``
print ("%s\n", str1);
print ("%s\n", str2);
return 0;
}

 valac --pkg glib-2.0 string._delimit.vala

See:




2022 vala-language.org