replace
Description:
Replace occurrences of the search string with the replacement string at a maximum of max_tokens
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 |
max_tokens |
The maximum number. If this is less than 0, the string will be replaced completely. |
Returns:
a string with the replaced values. |