Description
The Replace$ function replaces a specified part of a string with another string a specified number of times.
Usage
Same usage as the Replace option in an Edit menu.
Syntax
var$ = Replace$(
Parameters
<source_string>: string to be searched.
<search_string>: string, part of the string that will be replaced.
<replace_with_string>: string, replacement substring.
<count>: optional integer, number of substitutions to perform. Default is 0 which means make all possible substitutions.
<start>: optional integer, position within <source_string> where <search_string> search begins.
<end>: optional integer, position within <source_string> where <search_string> search finishes.
Return Value
var$: string, result of the replacement.
Remarks
The Replace$ function is case sensitive.
Examples
a$ = "Hello TesTask, Hellobis"
var$ = Replace$(a$, "Hello", "Hi")
msgbox(var$) ' displays Hi TesTask, Hibis
a$ = "Hello TesTask, Hellobis"
var$ = Replace$(a$, "Hello", "Hi", 1)
msgbox(var$) ' displays Hi TesTask, Hellobis
a$ = "Hello TesTask, Hellobis"
var$ = Replace$(a$, "Hello", "Hi", 0, 2, 8)
msgbox(var$) ' displays Hello TesTask, Hellobis - no changes as the Hello word is not found between the 2nd and 8th character.
