StrGetTokens

InstallShield 2014 » InstallScript Language Reference

The StrGetTokens function extracts substrings (tokens) from the string specified by szString and places them into the list specified by listID. The substrings in szString must be delimited—separated from one another—by one or more of the characters specified by szDelimiterSet.

For example, if you call StrGetTokens with the string "One;Two;Three;Four;Five" as the second parameter and ";" as the third parameter, listID will be returned with five strings: "One", "Two", "Three", "Four", and "Five". Use the list functions, such as ListGetFirstString and ListGetNextString to access each token in the list.

Note: If the first (or last) character of szString matches a character in szDelimiterSet, a null string ("") is not inserted in the list as the first (or last) element. Instead, the characters between the first and second (or last and next to last) delimiters are inserted in the list as the first (or last) element.

Syntax

StrGetTokens ( listID, szString, szDelimiterSet );

Parameters

StrGetTokens Parameters

Parameter

Description

listID

Returns a list of tokens. The string list identified by listID must already have been initialized by a call to ListCreate.

szString

Specifies the string to be parsed.

szDelimiterSet

Specifies a set of one or more delimiters. Each delimiter is one character (1 byte). If you pass a null string ("") in this parameter, the function searches for null characters as the delimiters. This is useful if you are using the GetProfString function.

Note: When a space is specified as the delimiter, StrGetTokens treats consecutive spaces as a single delimiter.

Return Values

StrGetTokens Return Values

Return Value

Description

0

Indicates that the function successfully separated the string and inserted the tokens into the specified list.

< 0

Indicates that the function was unable to separate the string and insert the tokens into the list.

See Also