The String class has a method called lastIndexOf. Try and see if that makes your parsing easier. :)