find_end_char_number

 

Contents

Description

Find the repeat appearance times of the end character at the end of a string.

Syntax

int find_end_char_number( const string & str, char ch )

Parameters

str
[input]string to be counted
ch
[input]character to be found in str

Return

the repeat appearance times of the end char in the end of str

Examples

EX1

void find_end_char_number_ex1()
{
    string str = "abcdeppp";
    char ech = 'p';
    //Change 'p' to other char to see different result 
    int nRet = find_end_char_number(str, ech);
    if(nRet)
    printf("End char \'%c\' repeat %d times in \"%s\" \n" ,ech,nRet,str);
    else
    printf("\'%c\' is not the end char in \"%s\"\n" ,ech,str); 
}

Remark

See Also

find_prefix_char_number

header to Include

origin.h

Reference