ReplaceString
All validation programs
Replaces one value with another and places the result in a variable.
Format of Parameters
SourceStr {
ALL
} OldString NewString {DestVar}
Where:
SourceStr
|
The location of the string to be changed. This can be a string constant in double quotes, a variable, If this parameter is not a variable, then DestVar is required. |
OldString
|
The substring to be replaced. The first occurrence (or all occurrences within SourceStr, if the ALL parameter is included before this one) will be replaced with NewString. This parameter can be a variable, , , or a string constant in double quotes. |
NewString
|
The substring to replace OldString in the SourceStr. This can be a variable, , , or a string constant in double quotes. |
DestVar
|
Required to hold the result if SourceStr is not a variable. If omitted, the result is stored back in the SourceStr variable. |
Example 1. This example removes a single quote by replacing ‘
with nothing. It places the result in the variable Patient_name. This removes quotes from values like O’Neill.
The parameters are:
Current_Element "
’
" "" Patient_name
.
Value before: O’Neill
Value after: ONeill
Once the quote-less value is in Patient_name, you can use it in other business rules such as ODBC rules.
Example 2. This example removes all hyphens within Current_Element by replacing hyphens with nothing. It places the result in the variable Phone_num.
The parameters are:
Current_Element ALL "-" "" Phone_num
Value before: 614-555-1212
Value after: 6145551212
Example 3. This example replaces a single quote with a double quote.
The parameters are:
PatientLastName "'" """ Patient_name
Value before: O’Neill
Value after: O”Neill