|
SplitToArray | |||||
Tokens = SplitToArray(SourceString$, DelimiterChrs$, OuputArray(), [OutputIndex=0], [Flags=7]) | |||||
Parameters: SourceString$ = The String you wish to break up DelimiterChrs$ = The characters that should be used as a delimiters (seperators) OuputArray() = The array that you wish to store the tokens in. [OutputIndex=0] = The starting position of where the tokens should be placed, defaults to 0 [Flags=7] = Flags control how the string is to be broken up |
|||||
Returns: Tokens = The number of tokens returned |
|||||
SplitToArray will cut a string up into what are called 'tokens' placed them into an array. This allows us to easily break up delimited strings (Strings with common separator characters in them) so you can work upon the fragments. SplitToArray is powerful enough to not only store the strings segments into a string arrays, but it can also convert the strings into integer or floating point arrays automatically for you. So it's perfect for dealing lists of values. Flag Bits Flags control how SplitToArray breaks up the string. By combining the flag values together, to can alter how the function behaves. It defaults to 7 which has all mode active (1 +2 +4). 1 = remove null strings 2 = left trim 4 = right trim FACTS: * SplitToArray can only stores values in 1D Integer, Float or String arrays. * SplitToArray will expand the target array if need be. However it doesn't Redim the array when resizing, so any previous information will be lost if SplitToArray needs to expand the array for you. Mini Tutorial #1: This example cuts a string of characters that are delimited using the ',' character into a string array. Notice how the string array is expanded to fit the new data.
This example would output.
Mini Tutorial #2: This example cuts a string of characters using a collection of delimiters using the ',' character into a string array. Notice how the string array is expanded to fit the new data.
This example would output.
Mini Tutorial #3: SplitToArray has This example cuts a string of characters using a collection of delimiters using the ',' character into a string array. Notice how the string array is expanded to fit the new data.
|
Related Info: | Dim | Instring | Left$ | Mid$ | Right$ : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |