AIX | HP-UX | Linux | OS/2 | OS/390 | OS/400 | PTX | SUN | Win NT |
X | X | X | X | X | X | X | X | X |
Purpose
Replaces characters in a string.
Format
@DTW_REPLACE(stringIn, stringFrom, stringTo, n, option, stringOut)
@DTW_REPLACE(stringIn, stringFrom, stringTo, n, stringOut)
@DTW_REPLACE(stringIn, stringFrom, stringTo, stringOut)
@DTW_rREPLACE(stringIn, stringFrom, stringTo, n, option)
@DTW_rREPLACE(stringIn, stringFrom, stringTo, n)
@DTW_rREPLACE(stringIn, stringFrom, stringTo)
Parameters
Table 94. DTW_REPLACE Parameters
Data Type | Parameter | Use | Description |
---|---|---|---|
string | stringIn | IN | A variable or literal string that is to be searched. |
string | stringFrom | IN | A variable or literal string that is to be replaced. |
string | stringTo | IN | A variable or literal string that replaces occurrences of stringFrom. |
integer | n | IN | The position of the character at which to begin the search. |
string | option | IN | Specifies whether to replace all occurrences, or just the first
occurrence, and can have one of the following values:
|
string | stringOut | OUT | A variable that contains stringIn with occurrences of stringFrom replaced by stringTo. |
Return Codes
Table 95. DTW_REPLACE Return Codes
Return Code | Explanation |
---|---|
-1001 | The server could not process a Net.Data request to allocate memory. |
1003 | An incorrect number of parameters were passed on a function call. |
1005 | A parameter passed on a function call, required to be a string variable, was of a different variable type. |
1006 | A literal string was passed on a function call for a parameter which was required to be an output parameter. |
Examples
Example 1:
@DTW_rREPLACE("ABCABCABC", "AB", "1234")