strReplace

Replaces an existing substring with another substring.

If there are multiple occurrences of the substring to be replaced, they will all be replaced by the new substring.

Note:

Use the Special String Operators for string concatenation, string inclusion, and simple comparison.

Type and Usage

Parameters

Takes three parameters:

  • The first parameter is the string on which the substitution will be performed.

  • The second parameter is the substring to be replaced.

  • The third parameter is the substring that will replace the existing substring.

Output

Returns a string.

Example

Replaces the word classified with restricted and results in the string This document is restricted.

<$strReplace("This document is classified.","classified","restricted")$>

Replaces the slashes in the date with periods, giving a date in the form 6.20.2001:

<$strReplace(formatDateOnly(dateCurrent()),"/",".")$>