how many times a string is repeated in another string
#7

The fastest way to do this, is:

PHP Code:
stock static countStrings(const string[], const needle[])
{
    new 
c;
    for(new 
i=strfind(string,needle,true); i!=-1i=strfind(string,needle,true,i+1)) c++;
    return 
c;

Speed Results against your function:

Code:
Your time with 100.000x: 3818ms
My time with 100.000x: 1466ms
Greekz
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)