new string[128], string2[128]; string = "No/nNo/nNo"; string2= "No";

stock GetQuantityStringInString(haystack[], needle[])
{
new pos,
result,
count;
for(;;) //if i use while(true) it give me a warning
{
result = strfind(haystack, needle, false, pos);
pos += result;
if(result == -1)
{
break;
}
else
{
count++;
}
}
return count;
}
stock GetQuantityStringInString(haystack[], needle[], ignorecase = true)
{
new temp[30], c = 0;
for(new i = 0, l = strlen(haystack)-strlen(needle); i <= l; ++i)
{
strmid(temp, haystack, i, i+strlen(needle));
if(!strcmp(needle, temp, ignorecase))c++;
}
return c;
}
if(!strcmp(needle, temp, ignorecase))c++;
|
stock GetQuantityStringInString(haystack[], needle[], bool:ignorecase = true) |
stock static countStrings(const string[], const needle[])
{
new c;
for(new i=strfind(string,needle,true); i!=-1; i=strfind(string,needle,true,i+1)) c++;
return c;
}
Your time with 100.000x: 3818ms My time with 100.000x: 1466ms