Difference between revisions of "Programmer Guide/Command Reference/TRANSLATE"

From STX Wiki
Jump to navigation Jump to search
Line 2: Line 2:
 
  <var>#str</var> := TRANSLATE <var>string</var> <var>sub<sub>1</sub></var> <var>trn<sub>1</sub></var> [ <var>sub<sub>X</sub></var> <var>trn<sub>X</sub></var> [ &hellip; ]]
 
  <var>#str</var> := TRANSLATE <var>string</var> <var>sub<sub>1</sub></var> <var>trn<sub>1</sub></var> [ <var>sub<sub>X</sub></var> <var>trn<sub>X</sub></var> [ &hellip; ]]
 
  <var>#str</var> := TRANSLATE <var>variable</var> <var>sub<sub>1</sub></var> <var>trn<sub>1</sub></var> [ <var>sub<sub>X</sub></var> <var>trn<sub>X</sub></var> [ &hellip; ]] /Variable
 
  <var>#str</var> := TRANSLATE <var>variable</var> <var>sub<sub>1</sub></var> <var>trn<sub>1</sub></var> [ <var>sub<sub>X</sub></var> <var>trn<sub>X</sub></var> [ &hellip; ]] /Variable
  <var>#str</var> := TRANSLATE <var>tabke</var> <var>sub<sub>1</sub></var> <var>trn<sub>1</sub></var> [ <var>sub<sub>X</sub></var> <var>trn<sub>X</sub></var> [ &hellip; ]] /Table
+
  <var>#str</var> := TRANSLATE <var>table</var> <var>sub<sub>1</sub></var> <var>trn<sub>1</sub></var> [ <var>sub<sub>X</sub></var> <var>trn<sub>X</sub></var> [ &hellip; ]] /Table
  
 
The {{STx}} command <code>TRANSLATE</code> returns a modified copy of its <var>string</var> argument, the modification being that all occurrences of the string <var>sub<sub>N</sub></var> are replaced by the string <var>trn<sub>N</sub></var>.
 
The {{STx}} command <code>TRANSLATE</code> returns a modified copy of its <var>string</var> argument, the modification being that all occurrences of the string <var>sub<sub>N</sub></var> are replaced by the string <var>trn<sub>N</sub></var>.

Revision as of 16:03, 2 May 2014

#str := TRANSLATE string sub1 trn1 [ subX trnX [ … ]]
#str := TRANSLATE variable sub1 trn1 [ subX trnX [ … ]] /Variable
#str := TRANSLATE table sub1 trn1 [ subX trnX [ … ]] /Table

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

If the option /Variable is specified, string is treated as the name of a variable whose contents will be used as the string to TRANSLATE. If the option /Table is specified, string is treated as the name of a table item whose contents will be used as the string to TRANSLATE.

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