Code:
#include <amxmodx>
public plugin_init()
{
server_print("Matches: United-States %i", HowManyMatches("United-States United-States U nite d-S tates U nite d-S tates United-States U nite d-S tates", "United-States"));
server_print("Matches: How %i", HowManyMatches("How Why Where How I went to the mark? How to kill a person?", "How"));
}
// Not case senstive
HowManyMatches(what[], with[])
{
new a, pos, count, len2 = strlen(with), test = strlen(what);
while(pos < test)
{
a = containi(what[pos], with);
if(a == -1)
{
break;
}
pos += len2 + a;
count++;
}
return count;
}
Edit:
Wait you mean how many complete words there are? or how many of a certain word?
ie..
1 word United
2 word States
Like that is what you mean?
__________________