Next: $U, Previous: $TIME, Up: Built-in functions [Contents][Index]
$TRANSLIT
: TransliterationThe macro ‘$TRANSLIT(s, from, to)’ interprets each of its arguments as strings (without expanding anything). Then s is modified by replacing any of the characters found in from by the corresponding characters in to. If to is shorter than from, then the excess characters in from are deleted from s. As a limiting case, if to is empty, then all the characters in from are deleted from s. For example, ‘$TRANSLIT(s, aeiou, 12345)’ replaces the vowels in s by the corresponding digits, and ‘$TRANSLIT(s, aeiou, )’ deletes all the vowels. The backslash may be used to escape a character, as in ANSI C. For example, ‘$TRANSLIT("a\\"\\\\d", "d\\\\a\\"", "D,A'")’ translates into ‘A',D’. Here one had to explicitly enclose strings involving ‘\\"’ in double quotes in order to avoid a complaint about an unterminated string.