Share via


CStringT::SpanExcluding

Extracts characters from the string, starting with the first character, that are not in the set of characters identified by pszCharSet.

CStringT SpanExcluding(
   PCXSTR pszCharSet
) const;

Parameters

  • pszCharSet
    A string interpreted as a set of characters.

Return Value

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

Remarks

SpanExcluding extracts and returns all characters preceding the first occurrence of a character from pszCharSet (in other words, the character from pszCharSet and all characters following it in the string, are not returned). If no character from pszCharSet is found in the string, then SpanExcluding returns the entire string.

Example

// The string can be delimited by a semicolon(;), 
//  a comma(,), a period(.), a dash(-), 
// or an apostrophe('). 
// typedef CStringT<TCHAR, StrTraitATL<TCHAR, ChTraitsCRT<TCHAR>>> CAtlString;

CAtlString src(_T("World Cup '98"));

_tprintf_s(_T("%s"),src.SpanExcluding(_T(";,.-'")));

Requirements

Header: cstringt.h

See Also

Reference

CStringT Class