-
-
Notifications
You must be signed in to change notification settings - Fork 18
string_replace_all
CryoEagle edited this page Dec 26, 2018
·
2 revisions
Returns a copy of a string with all instances of a given substring replaced with a new substring.
string_replace_all(str, substr, newstr);
Argument | Description |
---|---|
string str |
The string to be copied |
string substr |
The substring within the string to be replaced in all instances |
string newstr |
The new substring to replace the previous one(s) |
Returns: string
You can use this function to parse a string looking for specific parts, which can then be replaced by the new string that you have specified in all places that they occur.
str1 = 'Hexxo Worxd';
str2 = string_replace_all(str1, 'x', 'l');
This will set str2 to str1, but with its instances of 'x' replaced with 'l', resulting in str2 being 'Hello World'.
Back to strings