CStringT::TokenizeSee Also
CStringT Overview | Class Members
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.Res
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
CStringT Overview | Class Members
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.Res
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
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货