replace

From RPTools Wiki
Revision as of 12:03, 13 December 2008 by Craig (talk | contribs) (New page: ==Function replace== Returns the string with the occurrences of a pattern replaced by the specified value. If the number of times to perform the replacement is not specified then all occu...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function replace

Returns the string with the occurrences of a pattern replaced by the specified value. If the number of times to perform the replacement is not specified then all occurrences of the pattern are replaced. Pattern can be a regular expression.

Usage

[h: newStr = replace(str, pattern, value)]
[h: newStr = replace(str, pattern, value, times)]


Examples

    [r: replace("This is a test", " ", "-")]
    [r: replace("This is a test", " ", "-", 2)]

Returns

   This-is-a-test
   This-is-a test