stringReplace()

Synopsis

Replaces all occurrences of a substring in a string with a new substring. If any argument is NoValue , the function returns NoValue .

Syntax

stringReplace ( str As Any, _
                substr As Any, _
                replstr As Any ) As Any 
Argument Type Description
str Any a string to search in.
substr Any a substring of characters to look for.
replstr Any a substring of characters to replace with.

Example 1

Intent >stringReplace("Three big dogs are chasing", "dog", "pig")
--> "Three big pigs are chasing"

Example 2

Intent >stringReplace("Two small cats", "dogs", "foxes")
--> "Two small cats" 
The substring was not found, so no substitution occurred.

Example 3

Intent >stringReplace("Two small cats", NoValue, "foxes")
--> NoValue