This command is replaced by the Replace function.
To search a string for a substring, and if the substring is present, to replace the first occurrence of the substring with a different substring.
replace oldSubstring in hostString with newSubstring
hostString May be of any class except constant or expression.
Replace scans hostString for oldSubstring. If oldSubstring is in hostString, oldSubstring is removed, and newSubstring is inserted into hostString, Predefined Indicator found is set true, and the position at which oldSubstring began is moved to Predefined Variable strmark. If oldSubstring is not found, no deletion or insertion occurs, found is set false, and zero is moved to Predefined Variable strmark.
string park
move "Everglades National Park" to park
replace "Everglades" in park with "Yellowstone"
In this example, String Variable park is searched for the substring Everglades. Where Everglades is found (at the beginning in this case), it is removed, and the word Yellowstone inserted in its place.
Replace sets the value of Predefined Variable strmark, which is used by the mid and right commands when those commands omit a position specification. This is intended to facilitate implicit positioning illustrated by the following example:
string alpha_suffix
replace "A" in "123ABC" with "Z"
[found] right "123ZBC" to alpha_suffix
In this example, the replace command places a value of 4 (the position of A in 123ABC) in strmark. The succeeding right command will use 4 as the position specification, and move the substring (ZBC) beginning at that position to String Variable alpha_suffix. The action would be defeated if the right command had a position specifier.
If you wish to simply remove a substring from a hostString, replace it with "" (two quotation marks).
Replace is case-sensitive. Thus, the following newSubstring would not be executed, and found is set false:
replace "DEF" in "abcdefgh" with "xyz"