replace a word

RVL
RVL used Ask the Experts™
on
Hi
we would like to replace the word TYPE with '' in a column called HOLD
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
relace all hold with STRTRAN(hold,'TYPE',[''])

or case insensitive would be

relace all hold with STRTRAN(hold,'TYPE',[''],1,99,1)
I would guess RVL needs to replace this word by empty string not by apostrophs, so:

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...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial