RVL
asked on
replace a word
Hi
we would like to replace the word TYPE with '' in a column called HOLD
we would like to replace the word TYPE with '' in a column called HOLD
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
REPLACE hold WITH STRTRAN(hold,'TYPE','') FOR "TYPE" $ hold
Such replacement will replace ALL occurences, so words having TYPE substring inside will be damaged...
Better version could be:
REPLACE hold WITH LTRIM(STRTRAN(" " + hold + " "," TYPE "," ")) FOR " TYPE " $ " " + hold + " "
or case insensitive variant:
REPLACE hold WITH LTRIM(STRTRAN(" " + hold + " "," TYPE "," ", 1, -1, 1)) FOR " TYPE " $ " " + UPPER(hold) + " "
But the TYPE word can be followed by comma, point, or other separators now and not all occurences will be replaced...