compare two words

Hi all,

I am currently trying to compare two words. Example : String1 = "BAAA", String2 = "AA".

What i would like to do is to find how many occurrence of String2 present in String1. In my example, the occurrence of "AA" in "BAAA" will be twice. Locations are 2nd and 3d.

Is there any functions which can do such comparison and provide all the found locations of occurrence? I have found memchr(), but if i understand correctly, it will only give the first occurrence.

Thanks a lot in advance.
Last edited on
I don't think there is a standard function to provide all occurrences you'll just have to iterate through the search and count.
@Texan40 : I see, thanks a lot for the reply :)
Topic archived. No new replies allowed.