_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)])
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