2.2.3.15.8 string::FindToken

Description

Find a token in this string

Syntax

int FindToken( LPCSTR lpcszToken, char chDelimiter = 0 )

Parameters

lpcszToken
[input] pointer to a string representing the token to find
chDelimiter
[input] character to use as the delimiter

Return

The zero based index of the token if found, -1 if token was not found

Examples

EX1

void string_FindToken_ex1()
{
	string strColors = "red|green|blue";
	int nToken;
	
	nToken = strColors.FindToken("green", '|');
	out_int("", nToken);//1 
        
	nToken = strColors.FindToken("yellow", '|');
	out_int("", nToken);//-1 
}

Remark

See Also

string::GetNumTokens, string::GetToken

Header to Include

origin.h