convert() function

The convert() function searches a given variable and replaces each occurrence of a character by another.

Syntax

convert(var, str.exp1, str.exp2)

Parameter(s)

var Variable in which the specified string will be searched and replaced.
str.exp1 Specifies the characters to be replaced with the corresponding replacement characters from str.exp2.
str.exp2 Specifies the characters to replace the characters specified in str.exp1.

Description

Any character designated in str.exp1 is replaced with the corresponding replacement character from str.exp2. The correspondence is by column position in str.exp1 and str.exp2.

If the length of str.exp1 is shorter than str.exp2, all characters in str.exp2 beyond the length of str.exp1 are ignored.

If the length of str.exp1 is longer than str.exp2, all characters in str.exp1 beyond the length of str.exp1 are deleted from the result.

Note: It is necessary to use a nondefault compiler option setting to use this function. Inserting the line $options ext at the beginning of the source code accomplishes this.