A string replacement function, but specialized for doing multiple replacements in a single pass through the input string.
Based off Nim's strutils.multiReplace.
strutils.multiReplace
Time complexity: O(n)
Space complexity: O(n)
The string to replace values in
An object of replacements where keys are the search values and values are the replacement values
A new string with the replacements applied
String
multiReplace('a b c', {a: 'c', c: 'a'}); // 'c b a' Copy
multiReplace('a b c', {a: 'c', c: 'a'}); // 'c b a'
A string replacement function, but specialized for doing multiple replacements in a single pass through the input string.
Based off Nim's
strutils.multiReplace
.Time complexity: O(n)
Space complexity: O(n)