string::ReverseFind

Description

Search this string object for the last match of a character.

Syntax

int ReverseFind( char ch )

Parameters

ch
[input]The character to search for.

Return

Returns the index of the last character in this string object that matches the requested character; -1 if the character is not found.

Examples

EX1

void string_ReverseFind_ex1()
{
        string str1("abcabc");
        int nRet = str1.ReverseFind('b');
        out_int("", nRet);//4
        
        nRet = str1.ReverseFind('g');
        out_int("", nRet);//-1
}

EX2

void string_ReverseFind_ex2()
{
    string str = Project.GetName(true);
    printf("current project is %s\n", str);
    string strExt = str.Mid(str.ReverseFind('.')+1);
    if(strExt.CompareNoCase("OPJ") != 0)
        out_str("The current project is not an OPJ file, it might be an ORG file");
}

Remark

See Also

string::Find, string::FindOneOf

header to Include

origin.h