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