int strstr(string sub, string source)
int strstr(string sub, string source)
// Pass: The sub string to looks for, the source string to search through
// Return: The number of sub strings found
// Assmes:
// Note: If searching for two spaces, four spaces together will count as 3 instances
{
int i;
int count = 0;
int lensub = len(sub);
int lensource = len(source);
for (i = 0; i < lensource; i++)
{
if (!strcmp(sub, mid(source, i, lensub))) count++;
}
return count;
}
There are no talkbacks on this documentation page yet. Post the first?
Doc Nav |
![]() |
Your docs |
![]() |