Let's say we'have code like that;
String s = "ali trees tree";
System.out.println(s.indexOf("tree"));
The output is 4. It's the beginning position of "trees". "Trees" word includes "tree" and I think because of that it gives wrong result.
Is it a way to find "tree" word's index with indexOf() function?