| Syntax Color Legend |
|---|
| Command |
| Mandatory parameter |
| Optional parameter |
| Mandatory keyword |
| Optional keyword |
<Destination> := <Source>.REPLACE (<Search>, <Replace>[, <All>])
Returns a new string in which the all or only the first occurrences of the specified character(s) are replaced with another specified character or string.
Realstring
| Parameter | Description |
|---|---|
| <Destination> | The variable to hold the new text after the replace. |
| <Source> | An alphanumeric variable holding the source text. The value will not be changed by the string replace command. |
| <Search> | The character(s) which will be replaced. |
| <Replace> | The character(s) which will replace the character(s) specified in <Search>. |
| <All> | An optional Boolean setting. If set to false, only the first occurrence of the search character(s) will be replaced. If set to true, all the occurrences of the search character(s) will be replaced. The default setting is true. |
The string replace command is akin to the String.Replace Method in .NET with an additional option to restrict the replace to only the first occurrence.
orgstring := 'Helloween'
resultstring := orgstring.replace ('e', 'a', false)
// resultstring is now Halloween
resultstring := orgstring.replace ('e', 'a-a')
// resultstring is now Ha-allowa-aa-an