CHString::Find(LPCWSTR) 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(
  LPCWSTR lpszSub
);

Parameters

lpszSub

A substring 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 Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header chstring.h (include FwCommon.h)
Library FrameDyn.lib
DLL FrameDynOS.dll; FrameDyn.dll

See also

CHString

CHString::FindOneOf

CHString::ReverseFind