Replace |
Top Previous Next |
Syntax - Replace <variable name> <Expression> <Find> <Replacement> Where: <variable name> is the user defined name that is assigned to the variable. <Expression> is a literal string or a variable that contains a literal string. <Find> is a literal string or a variable that contains a literal string. <Replacement> is a literal string or a variable that contains a literal string.
Description: This command is used to replace one or more occurrences of the <Find> string with the <Replacement> string that are found in the <Expression> string. The resulting literal string is store as the <variable name>.
Note: If the <Replacement> is an empty string (""), the literal string stored as <Variable Name> will be the <Expression> with each occurrence of <Find> removed. If the <Find> is an empty string (""), the literal string stored as <Variable Name> will be the original <Expression>.
Sample: The following statement uses Replace to remove all hyphens from a social security number and stores the results as the variable NewString. Replace NewString "555-55-5555" "-" ""
|