I think your problem can be easily solved. There are many ways in which you can use the <String>.indexOf() method...
Take a look at this one.