Imagine I want to replace all occurrences of 'A' in a string with '1', 'B' with '2' and 'C' with '3'. I have currently
str.replace('A', '1').replace('B', '2').replace('c', '3')....
I know I can create a map with the chars to replace as keys and the replacements as values and iterate over it replacing each occurrence. I was wondering if there is shorter way using some regex or a method from String class i was not aware of. Something like
str.replaceEach([ABC],[123])