Freigeben über


CStringT::Right

Extracts the last (that is, rightmost) nCount characters from this CStringT object and returns a copy of the extracted substring.

CStringT Right(
   int nCount
) const;

Parameters

  • nCount
    The number of characters to extract from this CStringT object.

Return Value

A CStringT object that contains a copy of the specified range of characters. Note that the returned CStringT object can be empty.

Remarks

If nCount exceeds the string length, then the entire string is extracted. Right is similar to the Basic Right function (except that indexes in Basic are zero-based).

For multibyte character sets (MBCS), nCount refers to each 8-bit character; that is, a lead and trail byte in one multibyte character are counted as two characters.

Example

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

CAtlString s(_T("abcdef"));
ASSERT(s.Right(2) == _T("ef"));   

Requirements

Header: cstringt.h

See Also

Concepts

CStringT Class

CStringT Members