Replace - Built-in String Function¶
Purpose¶
Replace returns a string with all occurrences of substring replaced with another string.
Syntax¶
Replace(str1, str2, str3 [,bool])
Arguments¶
| Argument | Required | Description |
|---|---|---|
str1 |
Yes | Any valid string expression. The string in which the string will be replaced. |
str2 |
Yes | Any valid string expression containing the search string. |
str3 |
No | Any valid string expression containing the string which will replace all occurrences of str2 in str1. |
bool |
No | Any valid Boolean expression indicating if the search is case insensitive. |
Returns¶
String
Example¶
// Example case sensitive replace:
Let sTest = Replace("ABC123abc", "abc", "def" )
Return sTest // returns "ABC123def"
// Example case insensitive replace:
Let sTest = Replace("ABC123abc", "abc", "def", true)
Return sTest // returns "def123def"
See Also¶
Notes¶
- When the arguments cannot be converted to the specified type, a runtime error is generated.
- If
boolis omitted, the search will be case-sensitive.