CString::Find

Syntax

int Find( char ch ) const;

int Find( const char* pszSub ) const;

Parameters

ch

A single character to search for.

pszSub

A substring to search for.

Remarks

Searches this string for the first match of a substring. The function is overloaded to accept both single characters (similar to the run-time function strchr) and strings (similar to strstr).

Return Value

The zero-based index of the first character in this CString object that matches the requested substring or characters; -1 if the substring or character is not found.

Example

CString s( "abcdef" );

ASSERT( s.Find( 'c' ) == 2 );

ASSERT( s.Find( "de" ) == 3);

See Also

CString::ReverseFind, CString::FindOneOf