Replace substring in string |
![]() |
|
|
|
|
|
Calling Replace will scan the string object, locate all occurences of oldstr and replace them with newstr. The two strings may be of different length; newstr may even be an empty string (this is not allowed for oldstr). The return value is the number of replacements made.
ReplaceNoCase works in a similar way, but will disregard case when looking for instances of oldstr in the string object.
|
|
|
|
|
This method will replace a substring starting at 0-based position pos, numchars long, with newstr. The starting index and number of characters should not exceed the total length of the string, or an exception (program error) will be thrown.
As with Replace / ReplaceNoCase, the replacement string may be of different length than the portion being replaced, or may even be empty.
See also: Find, Replace, Compare