I am wondering if there's an easy way to detect "phrases" in two strings without it being in quotes. For example:
"i like jack in the box" and "jack in the box has good food"
In this case, "jack in the box" would be detected. Now I could potentially go through the whole first string, see if it's in the second string, which it's not... and keep cutting down to a smaller length and running it through the second string until I find the 3-word-match of "jack in the box"... but it's not too efficient.
Any help would be great -- thanks!
You are referring to the Longest Common Subsequence problem. This is used as the basis of a string comparison.
There are many SO questions relating to this problem: https://stackoverflow.com/search?q=longest+common+subsequence
The algorithm isn't too hard to implement. Wikipedia has pseudocode that you can use as a starting point.