is_repeat_str

 

Description

Get the repeat times of basic substring in a given string

Syntax

int is_repeat_str( string str )

Parameters

str
[input]string to be counted

Return

total repeat times of basic substring in the given string

Examples

EX1

void is_repeat_str_ex1()
{
        string str = "XYZXYZXYZ";
        //change str to "XXYY" to see different result
        int nRet = is_repeat_str(str);
        if(nRet>0)
                printf("the basic string repeats %d times  in \"%s\"\n" ,nRet, str );
        else
                printf("the \"%s\" is not a repeat string\n" , str);
}

Remark

See Also

header to Include

origin.h

Reference