Replaces individual characters within a string.
CONVERT(old-string, oldCharList, newCharList)
old-string is the original string.
oldCharList is the list of characters to be changed.
newCharList is a list of replacement characters.
The CONVERT function replaces every occurrence of each character in oldCharList that appears in old-string with the corresponding character listed in newCharList. This function treats oldCharList and newCharList as a list of characters rather than as a string of characters. For example, the first character in oldCharList is replaced by the first character in newCharList; the second character in oldCharList is replaced by the second character in newCharList, and so on.
CONVERT statement, CHANGE function.
OLDSTR = "HOLLYWOOD, CA 93062" A = "CA96" B = "FL32" NEWSTR = CONVERT(OLDSTR,A,B)
Replaces each occurrence of C, A, 9 and 6 in OLDSTR with F, L, 3 and 2, respectively. The resulting string (HOLLYWOOD, FL 33022) is placed in NEWSTR.
X = "ABC123DEF456DKDKEIS" Y = "C2DK" Z = "Z9:" A2 = CONVERT(X,Y,Z)
Changes the value of ABC123DEF456DKDKEIS to ABZ193:EF456::EIS and places this new value in A2. Note that K is missing from A2 because K did not have a replacement character in Z.