Export (0) Print
Expand All

CStringT::TrimLeft

Trims leading characters from the string.

CStringT& TrimLeft(
   XCHAR chTarget 
);
CStringT& TrimLeft(
   PCXSTR pszTargets 
);
CStringT& TrimLeft( );

chTarget

The target character to be trimmed.

pszTargets

A pointer to a string containing the target characters to be trimmed. All leading occurrences of characters in pszTarget will be trimmed from the CStringT object.

The resulting trimmed string.

Removes all leading and trailing occurrences of one of the following:

  • The character specified by chTarget.

  • All characters found in the string specified by pszTargets.

  • Whitespace.


// typedef CStringT<TCHAR, StrTraitATL<TCHAR, ChTraitsCRT<TCHAR>>> CAtlString;

CAtlString str;
str = _T("\t\t   ****Soccer is best!");

_tprintf_s(_T("Before: \"%s\"\n"), (LPCTSTR)str);
_tprintf_s(_T("After: \"%s\"\n"), (LPCTSTR)str.TrimLeft(_T("\t *")));

// Output:
// --------------------------
// Before:		****Soccer is best!
// After: Soccer is best!


Header: cstringt.h

Community Additions

ADD
Show:
© 2014 Microsoft