^string.replace[table_with_substitution_settings]
^string.replace[search_string;replace_string] [3.4.2]
Replaces substrings in the string using substitution settings.
Table_with_substitution_settings is an object of class table, containing two columns:
The first contains the substring to be replaced.
The second contains the substring to replace the first one.
It is not necessary to specify column names - you may call it 'from' and 'to' or simply skip naming by using nameless table.
Example $s[An ugly moment I'll remember!]
Original: $s<br />
$rep[^table::create{from to
An A
ugly magic}]
After replace: ^s.replace[$rep]
The code will output:
Original: An ugly moment I'll remember!
After replace: A magic moment I'll remember!