Trims leading and trailing characters from the string.
CStringT& Trim( );
The target character to be trimmed.
A pointer to a string containing the target characters to be trimmed. All leading and trailing occurrences of characters in pszTarget will be trimmed from the CStringT object.
Returns the trimmed string.
Removes all leading and trailing occurrences of one of the following:
// typedef CStringT<TCHAR, StrTraitATL<TCHAR, ChTraitsCRT<TCHAR>>> CAtlString;
str = _T("******Soccer is best!?!?!?!?!");
_tprintf_s(_T("Before: \"%s\"\n"), (LPCTSTR)str);
_tprintf_s(_T("After : \"%s\"\n"), (LPCTSTR)str.Trim(_T("?!*")));
// Before: ******Soccer is best!?!?!?!?!
// After: Soccer is best
The output from this example is as follows:
Before: "******Soccer is best, but liquor is quicker!?!?!?!?!"
After : "Soccer is best, but liquor is quicker"
(1500 characters remaining)
Thank you for your feedback