The ereplace() function searches a string expression for the search string and then, if at the start occurrence, replaces search.str with replacement.str for the amount of occurrences specified in occurrences.
ereplace(str.exp, search.str, replacement.str{,occurrences{,start}})
change() swap()
str.exp | String in which the specified search.str is searched for. |
search.str | String to search for in str.exp. |
replacement.str | String to replace the specified search.str. |
occurrences | Specifies the number of occurrences of search.str to be replaced by replacement.str. If not specified, defaults to 0, which replaces all found occurrences. |
start | Specifies which occurrence of search string the replacement begins. If not specified, defaults to 1. |
Assigns the value "The old time" to nstring.
$options ext nstring = ereplace("The new time","new","old")
This outputs "++-". The ereplace() function replaces one occurrence of "-" starting at the second occurrence.
print ereplace("---","-","+",2,1)
Array references, Array variable, Attribute count expression, del statement, delete() function, ereplace() function, extract() function, BASIC functions, ins statement, insert() function, locate statement, read statement, replace statement, ereplace() function, Statements and functions, Subvalue count expressions, swap() function, Value count expression