0 out of 1 rated this helpful - Rate this topic

CStringT::TrimLeft 

Trims leading characters from the string.


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

Parameters

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.

// cstringt_trimleft.cpp
#include <atlstr.h>
#include <stdio.h>

int main( int argc, char* argv[] )
{
    //typedef CStringT< TCHAR, StrTraitATL< 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 *")));

   return 0;
}

Output

Before: "                  ****Soccer is best!"
After : "Soccer is best!"
Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.