I'm sorry for asking this, but is there any magically easy way to count the number of occourances of a substring in a string... for example,Except, it works?Code:3 == count ("abbabab", "ab");
Printable View
I'm sorry for asking this, but is there any magically easy way to count the number of occourances of a substring in a string... for example,Except, it works?Code:3 == count ("abbabab", "ab");
I think the function you are after is in <string.h> or <cstring> ;)
sorry, a little intoxicated :)
here is the prototype -
char* strstr( const char* s1, const char* s2 )