$replace » History » Version 1
Per Amundsen, 08/10/2015 06:37 AM
| 1 | 1 | Per Amundsen | _Added in 1.8.10_ |
|---|---|---|---|
| 2 | |||
| 3 | *$replace(string,substring,newstring,...)* |
||
| 4 | |||
| 5 | Replaces any occurrence of substring in string with newstring. |
||
| 6 | |||
| 7 | _[[$replace]] is case-insensitive, see [[$replacecs]] for case-sensitive version._ |
||
| 8 | |||
| 9 | *Parameters* |
||
| 10 | |||
| 11 | string - The string to search. |
||
| 12 | substring - The substring to replace. |
||
| 13 | newstring - The new string to replace with. |
||
| 14 | ... - Additional substrings to replace. |
||
| 15 | |||
| 16 | *Example* |
||
| 17 | |||
| 18 | <pre> |
||
| 19 | ; Replace all occurrences of 'cd' in the string with 'xyz'. |
||
| 20 | //echo -ag $replace(abcdefg,cd,xyz) |
||
| 21 | |||
| 22 | ; Remove all occurrences of 'a', 'b', 'c', 'd' in the string with 'A', 'B', 'C', 'D'. |
||
| 23 | //echo -ag $replace(abcdefg,a,A,b,B,c,C,d,D) |
||
| 24 | </pre> |