It can indeed handle multiple replacements at once.
In order to achieve this, create a list with odd numbered elements being the key to look for, and even elements being what to replace it with. Order is of importance in some cases, as string map will scan the list and stop at the first match (ai needs to come before a, otherwize a will always make the match).
A simple example of a "map":
Code: Select all
set map [list "oldword1" "newword1" "oldword2" "oldword2" ...]
set map [list "aibo" "cool dog" "ai" "artificial intelligence" "a" "the letter a"]
You could also build this map using arrays and "array get", however, keep in mind that the order is not fixed when using "array get".
Code: Select all
set mymap(oldword1) "newword1"
set mymap(oldword2) "newword2"
set map [array get mymap]