string::Count

Description

Count number of occurances of specified character in string. Support wide characters

Syntax

int Count( int cChar )

Parameters

cChar
[input]charactor to count

Return

number of occurance times the given character appears in string

Examples

EX1

void string_Count_ex1()
{
    string str = "this is a test";
    //count the number of space character, nRet should be 3
    int nRet = str.Count(' ');    

    printf("The charactor \' \' appears %d times in string \"%s\" .\n" , nRet ,str);
}

Remark

See Also

header to Include

origin.h