CString::TrimLeft

This method trims leading white-space characters from the string. It also removes new line, space, and tab characters.

void TrimLeft();

void TrimLeft(
TCHAR chTarget );

void TrimLeft(
LPCTSTR lpszTargets ); 

Parameters

  • chTarget
    Specifies the target characters to be trimmed.
  • lpszTargets
    Specifies a pointer to a string containing the target characters to be trimmed.

Example

In this example, the string "\t\t ****Hockey is best!" becomes "Hockey is best!":

CString strBefore;
CString strAfter;

strBefore = _T("\t\t   ****Hockey is best!");
strAfter = strBefore;
strAfter.TrimLeft(T_("\t *"));

_tprintf(_T("Before: \"%s\"\n"), (LPCTSTR) strBefore);
_tprintf(_T("After : \"%s\"\n"), (LPCTSTR) strAfter);

Requirements

  Windows CE versions: 1.0 and later
  Header file: Declared in Afx.h
  Platform: H/PC Pro, Palm-size PC, Pocket PC

See Also

CString::TrimRight, CString::Mid, CString::Left, CString::Right, CString::MakeUpper, CString::MakeLower, CString::MakeReverse, CString::Format