CHString::Find(WCHAR) method (chstring.h)

[The CHString class is part of the WMI Provider Framework which is now considered in final state, and no further development, enhancements, or updates will be available for non-security related issues affecting these libraries. The MI APIs should be used for all new development.]

The Find method searches a string for the first match of a substring.


int Find(
  WCHAR ch



A single character that the method searches for.

Return value

If the Find method is successful, it returns the zero-based index of the first character in this CHString string that matches the requested substring or characters. If the substring or character is not found, the method returns a value of -1.


The Find method is overloaded to accept both single characters (similar to the runtime function, wcschr) and strings (similar to the runtime function, wcsstr).


The following code example shows the use of CHString::Find.

CHString s( L"abcdef" );
assert( s.Find( 'c' ) == 2 );
assert( s.Find( L"de" ) == 3 );


Requirement Value
Minimum supported client Windows 10 Build 20348
Minimum supported server Windows 10 Build 20348
Header chstring.h

See also