Freigeben über


CStringT::TrimRight

Trims trailing characters from the string.

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

Parameters

  • chTarget
    The target character to be trimmed.

  • pszTargets
    A pointer to a string containing the target characters to be trimmed. All trailing occurrences of characters in pszTarget will be trimmed from the CStringT object.

Return Value

The resulting trimmed string.

Example

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

CAtlString str;
str = _T("Soccer is best, but liquor is quicker!?!?!?!?!");

_tprintf_s(_T("Before: \"%s\"\n"), (LPCTSTR)str);
_tprintf_s(_T("After : \"%s\"\n"), (LPCTSTR)str.TrimRight(_T("?!")));

Remarks

The output from this example is as follows:

Before: "Soccer is best, but liquor is quicker!?!?!?!?!"

After : "Soccer is best, but liquor is quicker"

Requirements

Header: cstringt.h

See Also

Concepts

CStringT Class

CStringT Members

CStringT::Trim

CStringT::TrimLeft