CString::Right

This method extracts the last (rightmost) nCount characters from this CString object and retrieves a copy of the extracted substring. If nCount exceeds the string length, the entire string is extracted. Right is similar to the Basic RIGHT$ function, except that indexes are zero-based.

CString Right(
int nCount )
const; 

Parameters

  • nCount
    Specifies the number of characters to extract from this CString object.

Return Value

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

Example

The following example demonstrates the use of CString::Right.

// example for CString::Right
CString s( _T("abcdef") );
ASSERT( s.Right(2) == _T("ef") );

Requirements

  Windows CE versions: 1.0 and later
  Header file: Declared in Afx.h
  Platform: H/PC Pro, Palm-size PC, Pocket PC

See Also

CString::Mid, CString::Left