I'm sure other have ran into this issue;
You have a string, and in this string you'd like to replace multiple strings with multiple other strings.
For example:
s := 'The quick brown fox jumps over the lazy dog';
And we'd like to replace "brown" with "yellow", "dog" with "Golden Retriever" and "lazy" with "old".
Option 1 is to run StringReplace 3 times, for example:
s := stringreplace(s,'brown','yellow',[rfReplaceAll]);
s := stringreplace(s,'dog','Golden Retriever',[rfReplaceAll]);
s := stringreplace(s,'lazy','old',[rfReplaceAll]);
Option 2 is by nesting StringReplace:
s := stringreplace(stringreplace(stringreplace,'brown','yellow',[rfReplaceAll]),'dog','Golden Retriever',[rfReplaceAll]),'lazy','old',[rfReplaceAll]);
(definitely hard to follow and read)
Option 3 is a using "StringsReplace()" which takes 2 arrays, one array with the words to look for, and one array with the words to replace them with:
s := StringsReplace(s,['brown','dog','lazy'],['yellow','Golden Retriever','old'],[rfReplaceAll]);
Obviously the latter is easier to write and read and does it all ...