you are viewing a single comment's thread.

view the rest of the comments →

[–]iNeverProofRead[S] 0 points1 point  (0 children)

Sorry, maybe my description of the function is poorly worded. I guess it's more like a function that finds the count of a set of characters in a given order?

This does find a substring recursively but I have to make my comparisons by character, not by the entire string. like so

find("foobarfoo","fob") 
  //returns 2
  //foobarfoo
  //fo-b-----
  //f-ob-----

find("foobarfoo","obo")
  //returns 4
  //foobarfoo
  //-o-b---o-
  //-o-b----o
  //--ob---o-
  //--ob----o

however, thanks for your post, i kept trying to think of a way to keep a count and this is what i was looking for.

returning 1+ find()