Find one of a number of characters

Web Site  Methods

 
Str::FindOneOf
 
CPOS FindOneOf (const STRCHAR* charset, CPOS startat = 0) const

FindOneOf will search the string, starting at position startat, for one of the characters in the passed string, and will return the index of the first matching character. If no matches are found, -1 is returned. The search is case-insensitive.

Example:

   Str data (_T("info@utilitycode.com")); 
   const STRCHAR* symset1 = _T(".@");
   const STRCHAR* symset2 = _T("~!#");
   ASSERT(data.FindOneOf(symset1) == 4); 
   ASSERT(data.FindOneOf(symset2) == (CPOS) -1);

See also: Find, Replace, Compare