Now I realize this could be simply implemented with
return this.indexOf(needle); but the flaw in that is that it will search the entire (potentially somewhat lengthy, you never know) String in its endeavor to find the index, when I really only care if its non-zero.
My current solution, which passes my testing so far, is thus. I'm open to all feedback, but I'm most interested in
- Corner-cases this fails for
- To a reasonable extent, style
I've also decided to tack it onto the class itself (I have to admit, I like being able to do that!) Is that bad practice?