ReplaceString()
Syntax
String$ = ReplaceString(String$, StringToFind$, StringToReplace$ [, Mode [, StartPosition]])Description
Try to find any occurrences of 'StringToFind$' in the given 'String$' and replace them with 'StringToReplace$'. An optional 'StartPosition' parameter may be specified to tell at which position the replace should start. First 'StartPosition' index is 1.
'Mode' is optional and may be a combination of the following values:#PB_String_NoCase : Case insensitive search (A=a). By default the search is case sensitive. #PB_String_InPlace: In place replacing. This means that the string is replaced directly in the memory. The 'StringToFind$' and 'StringToReplace$' parameter must have the same length ! This is a dangerous option, for advanced users only. The advantage is the very high speed of the replacement. When using this option, the result of ReplaceString() has to be ignored (and not affected to something, as this is the string passed in parameter which is changed).Example:
Debug ReplaceString("This is Art", " is", " was") ; Will display "This was Art" Debug ReplaceString("Hello again, hello again", "HELLO", "oh no...", 1, 10) ; Will display "Hello again, oh no... again" test$ = "Bundy, Barbie, Buddy" ReplaceString(test$, "B", "Z", 2, 1) ; all B gets changed to Z (directly in memory, no valid return value here) Debug test$ ; Output of the changed string
Supported OS
All