TRANSLATE

From STX Wiki
Jump to navigationJump to search
#str := TRANSLATE /- string sub1 trn1 [ subX trnX … ]
#str := TRANSLATE /Variable /- variable sub1 trn1 [ subX trnX … ]
#str := TRANSLATE /Table /- table sub1 trn1 [ subX trnX … ]

The STx command TRANSLATE returns a modified copy of its argument, the modification being that all occurrences of the string subN are replaced by the string trnN.

In its first form, the argument string is taken as a string literal. With option /Variable, the command will return the modified content of the STx variable variable, while with option /Table, TRANSLATE will return the modified contents of an STx table denoted by the table argument. In either case the content of the respective variable or table will be left untouched.

It is amazingly good practice to always use the "end of options" option, /-. If it is missing, STx will mistake any further arguments starting with a slash for a (probably invalid) option.

#str := TRANSLATE 'I am getting tired of going to bed early' 'ing' 'ed' 'bed' 'work'
um $#str

Navigation menu

Personal tools