string::FindOneOf

Description

Search this string for the first character that matches any character contained in lpszCharSet.

Syntax

int FindOneOf( LPCSTR lpszCharSet )

Parameters

lpszCharSet
[input] string containing characters for matching.

Return

The zero-based index of the first character in this string that is also in lpszCharSet. -1 if there is no match.

Examples

EX1

void string_FindOneOf_ex1()
{
        string str("abcdef");
        int nRet = str.FindOneOf("cd"); //return the first matching index
        out_int("", nRet); // 2
        
        nRet = str.FindOneOf("xd");
        out_int("", nRet); // 3
        
        nRet = str.FindOneOf("gh");
        out_int("", nRet); // -1
}

Remark

See Also

string::Find

header to Include

origin.h