replace


Description:

public string replace (string old, string replacement)

Replace all occurrences of the search string with the replacement string

Example: Replace all occurrences of a string:

public static int main (string[] args) {
// Output: ``An apple a day keeps the TARDIS away``
string res = "An apple a day keeps the doctor away".replace ("doctor", "TARDIS");
print ("%s\n", res);
return 0;
}

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

Parameters:

old

The value being searched for

replacement

The replacement value that replaces old values.

Returns:

a string with the replaced values.