Documentation Comments
Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.
Reality V15.0 ()
CHANGE Statement (DataBasic MultiValue Compatibility) (m6187ai+change_s.htm)
Replaces a substring with a new substring.
This statement is provided for compatibility with other MultiValue systems.
CHANGE oldSubstr TO newSubstr IN varString{, count{, startOccur}})
oldSubstr The substring to be changed.
newSubstr The replacement substring.
varString A variable or an element in a dimensioned array containing the string to change. On return, this will contain the modified string.
Note: varString cannot be an element in a dynamic array, nor a substring reference.
count The number of occurrences of oldSubstr to replace with newSubstr. If omitted or less than 1, all occurrences are replaced.
startOccur The number of the first occurrence to replace. If omitted or less than 1, the first occurrence is assumed.
The parameters oldSubstr and newSubstr can be any expressions that evaluate to strings.
varString must be a variable containing the string to be changed. Note that the contents of this variable are modified by the CHANGE statement.
If data case insensitive mode is selected (see Case Sensitivity), case is ignored when searching varString for oldSubstr.
MYSTR = "IRVINE, CA 92714" A = "92714" B = "92720" CHANGE A TO B IN MYSTR
Replaces substring A (92714) in MYSTR with substring B (92720). On completion, MYSTR contains IRVINE, CA 92720.
X = "31AA42BB53AAA" Y = "AA" Z = "CC" CHANGE Y TO Z IN X
Changes the contents of variable X from "31AA42BB53AAA" to "31CC42BB53CCA".
X = "31AA42BB53AAA" Y = "AA" Z = "CC" CHANGE Y TO Z IN X, 1
Changes the contents of variable X from "31AA42BB53AAA" to "31CC42BB53AAA". The second occurrence of "AA" is not changed because only one occurrence is changed.
X = "31AA42BB53AAA" Y = "AA" Z = "CC" CHANGE Y TO Z IN X, 0, 2
Changes the contents of variable X from "31AA42BB53AAA" to "31AA42BB53CCA". The first occurrence of "AA" is not changed because replacement starts at the second occurrence.