CString::TrimLeft

voidTrimLeft();

void CString::TrimLeft( TCHAR chTarget );

void CString::TrimLeft( LPCTSTR lpszTargets );

Parameters

chTarget

The target characters to be trimmed.

lpszTargets

A pointer to a string containing the target characters to be trimmed.

Remarks

Call the version of this member function with no parameters to trim leading whitespace characters from the string. When used with no parameters, TrimLeft removes newline, space, and tab characters.

Use the versions of this function that accept parameters to remove a particular character or a particular group of characters from the beginning of a string.

 For more information, see in Visual C++ Programmer’s Guide

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);

CString OverviewClass MembersHierarchy Chart

See Also   CString::Mid, CString::Left, CString::Right, CString::MakeUpper, CString::MakeLower, CString::MakeReverse, CString::Format