Introduced in the 1990 ANSI M[UMPS] language standard.

This function returns a translated version of the value of the input-string.

**SET** UP="ABCDEFGHIJKLMNOPQRSTUVWXYZ"

**SET** LO="abcdefghijklmnopqrstuvwxyz"

**SET** X="ABCdef"

Reference | Value | |
---|---|---|

$TRANSLATE(X,LO,UP) |
"ABCDEF" | |

$TRANSLATE(X,UP,LO) |
"abcdef" | |

$TRANSLATE(X,LO) |
"ABC" | |

$TRANSLATE(X,UP) |
"def" |

Note that case conversion using
` $CHAR($ASCII(X)+32)` and

Assume that `X="12/26/94"`

Reference | Value | |
---|---|---|

$TRANSLATE("Yy/Mm/Dd","Mm/Dd/Yy",X) |
"94/12/26" | |

SET X=122694$TRANSLATE("efabcd","abcdef",X) |
"941226" |

**SET** (FORWARD,BACKWARD)=""

**FOR** K=0:1:255 **SET** FORWARD=FORWARD_**$CHAR**(K)

**FOR** K=0:1:255 **SET** BACKWARD=**$CHAR**(K)_BACKWARD

**$TRANSLATE**(FORWARD,BACKWARD,"ABCDE") = "EDCBA"

` $TRANSLATE(string,$TRANSLATE(string,"0123456789"))`
will return only the digits that occur in the value of

` SET X="abc123cde654ghi"
$TRANSLATE(X,$TRANSLATE(X,"1234567890"))`
returns

The "inner" **$TRANSLATE** returns a value that is the
original value of `X`, with all digits removed.

The "outer" **$TRANSLATE** returns a value that is the
original value of `X`, with all characters removed that
occur in the return value of the inner **$TRANSLATE**.

Effectively, this combination of two nested **$TRANSLATE**s
will return only those characters from the original value of
`X` that occur in the value of the second parameter of in
"inner" **$TRANSLATE**.

Examples with naked references:

**$TRANSLATE**(VALUE,OLD)

**SET** ^ABC(1,2)="reset naked indicator"

; Naked indicator is now `^ABC(1,
SET ^(3,4)=$TRANSLATE(^(5,6),^(7,8))`

; 1. fetch ^(5,6) =

; 2. fetch ^(7,8) =

; 3. store ^(3,4) =

; Naked indicator is now:

**$TRANSLATE**(VALUE,OLD,NEW)

**SET** ^ABC(1,2)="reset naked indicator"

; Naked indicator is now `^ABC(1,
SET
^(3,4)=$TRANSLATE(^(5,6),^(7,8),^(9,10))`

; 1. fetch ^(5,6) =

; 2. fetch ^(7,8) =

; 3. fetch ^(9,10) =

; 4. store ^(3,4) =

; Naked indicator is now:

This document is © Ed de Moel, 1995-2005.

It is part of a book by Ed de Moel that is published under
the title "M[UMPS] by Example" (ISBN 0-918118-42-5).

Printed copies of the book are no longer available.