Returns a string corresponding to the replacement of a given string with another in the specified string.
A String equivalent to str but with all instances of oldValue replaced with newValue.
This function performs a word (case-sensitive and culture-sensitive) search to find oldValue.
Exception Type | Condition |
---|---|
ArgumentException | oldValue is an empty string. |
string::replace('testing string', 'test', 'winn') ==> 'winning string'
string::replace('testing string', 'foo', 'winn') ==> 'testing string'
string::replace('testing string', 'ing', '') ==> 'test str'
string::replace('banana', 'ana', 'ana') ==> 'banana'
StringFunctions Class | NAnt.Core.Functions Namespace