Topic Path: Symbol Reference > Functions > BreakApart Function
BreakApart Function

Separates a string into a list of tokens using a specified delimiter.

function BreakApart(
    BaseString: string; 
    BreakString: string; 
    StringList: TIdStrings
): TIdStrings;
Values to be broken into tokens.
Delimiter between tokens in the origin data.
Container for tokens found in the origin data. 

TIdStrings - Container for tokens found in the string value.

BreakApart is a TIdStrings function that separates the values in BaseString into tokens using the delimiter specified in BreakString. Tokens are extracted from BaseString starting at the left-most position, and continuing until no more data remains to be processed in BaseString. 

Each token located in BaserString is added to the container in StringList, and both the token and the delimiter in BreakString are removed from BaseString. 

If BreakString does not occur in BaseString, the entire value in BaseString is added to StringList as a single token, and removed from the data to be processed in BaseString. 

The process repeats until no more BreakString delimiters are found in BaseString, or until no more unprocessed data remains in BaseString. 

The return value for the function is the argument specified in StringList after tokens have been added to the container.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.