The EREPLACE function replaces a substring in an expression with another substring.
If you do not specify an occurrence, it replaces each occurrence of a string.
EREPLACE(expression, substring, replacement [, occurrence [, begin]])
occurrence specifies the number of occurrences of substring to replace. To replace all occurrences, specify occurrence as a number less than 1. begin specifies the first occurrence to replace. If begin is omitted or less than one, it defaults to one. If substring is an empty string, replacement is prefixed to expression. If replacement is an empty string, it removes all occurrences of substring. If expression evaluates to null, it returns null. If substring, replacement, occurrence, or begin evaluates to null, the EREPLACE function fails and the program terminates with a run-time error message. The EREPLACE function behaves like the CHANGE function except when substring evaluates to an empty string.
A = "AAABBBCCCDDDBBB"
PRINT EREPLACE (A,"BBB","ZZZ")
PRINT EREPLACE (A,"","ZZZ")
PRINT EREPLACE (A,"BBB","")
The output of this program is: