Tr()
FUNCTION: tr(<string>, <find>, <replace>)
Translates every grapheme cluster in <string> that exists in <find> to the cluster at the same position in <replace>. A grapheme cluster is a user-perceived character: a single letter, a multi-byte Unicode character, an emoji, or a base character with combining marks.
<find> and <replace> must contain the same number of grapheme clusters after expansion of ranges. If a cluster appears more than once in <find>, only the last instance is used.
ASCII ranges separated by - are accepted: a-z, A-Z, a-Z, and 0-9. Literal -’s can appear in <find> and <replace> if they are not part of valid ranges. Non-ASCII clusters are always treated as literals.
Color codes (ansi()) in the input string are preserved.
Examples:
> say tr(hello,abcdefghijklmnopqrstuvwxyz,nopqrstuvwxyzabcdefghijklm)
You say, "uryyb"
> say tr(uryyb, a-z, n-za-m)
You say, "hello"
> say tr(This is an example, a-Z, n-za-mN-ZA-M)
You say, "Guvf vf na rknzcyr."