Replaces substrings in a string.
StringReplace ( "string", "searchstring/start", "replacestring" [, occurrence [, casesense]] )
| string | The string to evaluate. |
| searchstring/start | The substring to search for or the character position to start the replacement. |
| replacestring | The replacement string. |
| occurrence | [optional] The number of times to replace the searchstring. Use a negative occurrence to replace from the right side. 0 = all searchstrings will be replaced (default) |
| casesense | [optional] Flag to indicate if the operations should be case sensitive. 0 = not case sensitive, using the user's locale (default) 1 = case sensitive 2 = not case sensitive, using a basic/faster comparison |
Local $text = StringReplace("this is a line of text", " ", "-")
Local $numreplacements = @extended
MsgBox(0, "New string is", $text)
MsgBox(0, "The number of replacements done was", $numreplacements)