$replacex » History » Version 3
Per Amundsen, 02/23/2023 07:29 PM
1 | 1 | Per Amundsen | _Added in 1.9.0_ |
---|---|---|---|
2 | |||
3 | *$replacex(string,substring,newstring,...)* |
||
4 | |||
5 | 2 | Per Amundsen | Replaces any occurrence of substring in string with newstring except for replacements that have already been made. |
6 | 1 | Per Amundsen | |
7 | _[[$replacex]] is case-insensitive, see [[$replacexcs]] for case-sensitive version._ |
||
8 | |||
9 | *Parameters* |
||
10 | |||
11 | 3 | 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 $replacex(abcdefg,cd,xyz) |
||
23 | |||
24 | ; Remove all occurrences of 'a', 'b', 'c', 'd' in the string with 'A', 'B', 'C', 'D'. |
||
25 | //echo -ag $replacex(abcdefg,a,A,b,B,c,C,d,D) |
||
26 | </pre> |