I am looking for the quickest and simplest way to determine whether or not a one word substring occurs in a given right-to-left string.
If it’s worth noting, I am going to be implementing the algorithm using Objective C and in an iPhone app. I have also searched for this algorithm, and found algorithms such as KMP, or BM, which as I figured, were ment to be used for more-than-one-word substring. If my assumption is wrong, please let me know!
Thanks ahead,
iLyrical.
How about:
edit Though I’ve never tried it on a right to left string….And I realize this will not match the first or last word…so after this you will have to check those too :-S
another edit You could also use regular expressions. The
NSRegularExpressionclass will allow you to do this. The one you want it\s*foo\s*