replaceMultipleCharacters
Modified on Wed, 16 Aug 2023
Description
Replace multiple characters in a string according to a given mapping
Syntax
replaceMultipleCharacters(text, replacements)
Parameters
Input Parameter | Type | Description |
---|---|---|
text | string | The input string to perform replacements on |
replacements | object | An object containing characters to replace and their corresponding replacements |
Return value
Type |
---|
string |
Sample
Example | Result | Description |
---|---|---|
replaceMultipleCharacters('a quick brown fox jumps over the lazy dog', { 'a': 'b', 'e': 'f', 'o': 'x' }) | 'b quick brxwn fxx jumps xvfr thf lbzy dxg' | The result string with specified characters replaced |
To view all the String functions, click here.
See Also
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article