Tinderbox v9 Icon

List/Set.tr(inStr, outStr)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Last Altered: 

 Function  [other Function type actions]

 Item  [operators of similar scope]

 Data manipulation  [other Data manipulation operators]

 Baseline

 As at baseline


List.tr(inStr, outStr)

This operator allows simple single character string manipulation. It computes a new list, copying each character of the source list but converting any characters in inStr to the corresponding characters in outStr. For example:

$MyList = $MyList.tr("a","A"); 

returns a copy of $MyList in which every "a" is converted to "A".

Backslash characters must be quoted and escaped:

$MyList = $MyList("c","\\r"); 

converts every "c" to a Macintosh newline characters (\r) . Note the need in this context for an extra backslash escape (so Tinderbox knows the intended swap value is "\r" and not "r").

For further information, see the macOS X man page for the UNIX tr command.