CString::SpanExcluding

CString SpanExcluding( LPCTSTR lpszCharSet ) const;
throw( CMemoryException );

Return Value

A substring that contains characters in the string that are not in lpszCharSet, beginning with the first character in the string and ending with the first character found in the string that is also in lpszCharSet (that is, starting with the first character in the string and up to but excluding the first character in the string that is found lpszCharSet). It returns the entire string if no character in lpszCharSet is found in the string.

Parameters

lpszCharSet

A string interpreted as a set of characters.

Remarks

Use this function to search the string for the first occurrence of any character in the specified set lpszCharSet. SpanExcluding extracts and returns all characters preceding the first occurrence of a character from lpszCharSet (in other words, the character from lpszCharSet and all characters following it in the string, are not returned). If no character from lpszCharSet is found in the string, then SpanExcluding returns the entire string.

Example

The following function returns the first portion of the src param.

// Portions are delimited by a semi-colon( ; ),
//  a comma( , ), a period( . ), a dash( - ),
// or a colon( : ).

CString GetFirstPart( CString src)
{
    return src.SpanExcluding( ";,.- :");
}

CString OverviewClass MembersHierarchy Chart

See Also   CString::SpanIncluding