Convert Function

Replaces every instance of specified characters in a string with substitute characters.

Syntax

Convert (list, new.list, string)

list is a list of characters to replace. If list is a null value it generates a runtime error.

new.list is a corresponding list of substitute characters. If new.list is a null value, it generates a runtime error.

string is an expression that evaluates to the string, or a variable containing the string. If string is a null value, null is returned.

Remarks

The two lists of characters correspond. The first character of new.list replaces all instances of the first character of list, the second replaces the second, and so on. If the two lists do not contain the same number of characters:

  • Any characters in list with no corresponding characters in new.list are deleted from the result.
  • Any surplus characters in new.list are ignored.

Example

This is an example of Convert used as a function:

MyString ="NOW IS THE TIME"
ConvStr = Convert("TI", "XY", MyString) 
* all T => X, I => Y
* At this point ConvStr is: NOW YS XHE XYME
ConvStr = Convert("XY", "Z", ConvStr) 
* all X => Z, Y => ""
* At this point ConvStr is: NOW S ZHE ZME