|
Replace$ | |||
Result$ = Replace$(SourceString$, FindString$, ReplaceString$, [StartPos=1], [CaseFlag=1], [FirstFlag=0]) | |||
Parameters: SourceString$ = The String you wish to search and replace words/characters in FindString$ = The String of characters you wish to find in the search string ReplaceString$ = The characters you wish to insert in FindStrings place [StartPos=1] = The character to start searching in Source String at [CaseFlag=1]= Use case insensitive matching (0=no, 1= yes) [FirstFlag=0] = Replace only the first occurrence ? (0 = no, 1=yes) |
|||
Returns: Result$ = The Source String after the replacements have been made |
|||
The Replace$() function will scan through a string and remove/replace words or groups of characters with another one. Replace$ often used to filter strings and remove any unwanted characters or words from them. The command lets you controls over where to start searching in the source string, as well as how it should perform the matching and even if it should replace every occurrence or just the first. Allowing you to manipulate the string with greater control and flexibility. FACTS: * Use Instring() to search for a words or characters wiuthin a string. Mini Tutorial #1: This example uses the replace$ function to change words and characters within a string.
This example would output.
Mini Tutorial #2: This example loads a ASCII text file into a string array. The replace$ function is used here to removed unwanted EndOfLine characters from the ASCII text, which is then passed to the SplitToArray function.
|
Related Info: | Insert$ | Instring | Make$ | Pad$ | SplitToArray : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |