Export (0) Print
Expand All

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 characters in pszTarget will be trimmed from the CStringT object.

Return Value

The resultant trimmed string.

Remarks

Removes a particular character or particular group of characters from the beginning of a string.

Example

The following example demonstrates the use of CStringT::TrimLeft.

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

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

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

Output

Before: "                  ****Soccer is best!"
After : "Soccer is best!"

See Also

CStringT Overview | Class Members

Show:
© 2014 Microsoft