Export (0) Print
Expand All

CStringT::Tokenize

Extracts specified tokens in a target string.

CStringT Tokenize(
   PCXSTR pszTokens,
   int& iStart
) const;

Parameters

pszTokens
A string containing token separators.
iStart
The zero-based index to begin the search.

Return Value

A CThisString object containing the current token value.

Remarks

Call this function to search for tokens in the given string. The pszTokens is a string containing the token separators. Parsing of the target string begins at the iStart position.

Example

The following example demonstrates the use of CStringT::Tokenize.

//typedef CStringT< TCHAR, StrTraitATL< TCHAR > > CAtlString;
CAtlString str( "%First Second#Third" );
CAtlString resToken;
int curPos= 0;

resToken= str.Tokenize("% #",curPos);
while (resToken != "")
{
   printf("Resulting token: %s\n", resToken);
   resToken= str.Tokenize("% #",curPos);
};

Output

Resulting Token: First
Resulting Token: Second
Resulting Token: Third

See Also

CStringT Overview | Class Members

Show:
© 2014 Microsoft