exchange() function

The exchange() function replaces the character specified as a hexadecimal string in str.exp1 with the character specified as a hexadecimal string in str.exp2.

Syntax

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

Parameter(s)

var Specifies the variable in which the specified string will be searched and replaced.
str.exp1 Specifies the character in hexadecimal string format to be replaced with the corresponding replacement character in hexadecimal string format from str.exp2.
str.exp2 Specifies the character in hexadecimal string format to replace the character specified in hexadecimal string format in str.exp1.

Description

This function works like the convert() function, except that the second two arguments are specified as hexadecimal strings and only a single character can be exchanged.

Example(s)

Example 1

In this example, the result is bbc:
 
 crt exchange("abc",dtx(seq("a")),dtx(seq("b")))

Example 2

 * exchange commas to attribute marks
 var = "a,b,c"
 str.exp1 = "2c"
 str.exp2 = "fe"
 result = exchange( var, str.exp1, str.exp2 )
 crt "var = " : var
 crt "result = " : result