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.

Syntax

int Find(
  WCHAR ch
);

Parameters

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.

Remarks

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

Examples

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 );

Requirements

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

See also

CHString

CHString::ReverseFind

CHString::FindOneOf