Was this helpful?
_StringTokenSub Function
This procedure substitutes a value for the specified token in a string.
Only the first occurrence of the token will be replaced.
This function has the following syntax:
varchar(2000) =_StringTokenSub(string=varchar(2000),
              token=varchar(256),
              replacewith=varchar(256)
              [, remainingtokens=byref(integer)])
Arguments
Data Type
Description
string
Varchar(2000)
The string where substitution is necessary
token
Varchar(256)
The text that will be substituted
replacewith
Varchar(256)
The text to substitute for the token
remainingtokens
Integer
(Optional) The number of occurrences of tokens that remain in the string after the substitution
Example—_StringTokenSub function:
str1 = _StringTokenSub(string='Employee Name:John Doe, Address: 101 California, USA (c/o John Doe)', token = 'John Doe', replacewith='Jane Doe', remaingtoken=byref(icount));
This example returns “Employee Name:Jane Doe, Address:101 California, USA (c/o John Doe)”. The icount variable contains 1, indicating that there is one more occurrence of John Doe in the substituted string.
Last modified date: 12/20/2023