2.2.3.15.32 string::Right

Description

Extract the rightmost nCount characters from this string object and returns a copy of the extracted substring. If nCount exceeds the string length, then the entire string is extracted.

Syntax

string Right( int nCount )

Parameters

nCount
[input]The number of characters to extract starting from the rightmost.

Return

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

Examples

EX1

void string_Right_ex1()
{
    string str1("abcdef");
    string str2 = str1.Right(5);
    //after extracted,str2 should be "bcdef"
    printf("the extracted substring is \"%s\"\n", str2);
}

Remark

See Also

string::Left, string::Mid

Header to Include

origin.h