The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



Tokenize


Unit:SDL_stringl
Class: none
Declaration: [1] function Tokenize (Instring: string; const Separator: string; var Tokens: TOpenStringArray): integer;
[2] function Tokenize (Instring: string; const Separator: string; const EscapeChar: char; var Tokens: TOpenStringArray): integer;

The function Tokenize splits the string Instring into substrings which are separated by the string Separator. The substrings are stored in the dynamic array Tokens. The function returns the number of tokens found. Version [2] of Tokenize allows to specify an escape character for the separator (parameter EscapeChar). If the separating character is preceded by an escape character the separating character is included in the token instead of triggering a split of Instring.

Hint: Please note, that the number of tokens is limited to 1000. If a string contains more than 1000 tokens, the rest of the tokens are not resolved and returned as the last token (i.e. Tokens[999]).

Hint 2: The version [2] of Tokenize is not available under Delphi 6 & 7.



Last Update: 2023-Feb-06