Results 1 to 1 of 1
java.lang.String class has a method called substring, that is very useful in parsing operations. You need to know the starting and ending index of text in a String object to make use of substring method.
Review following example. We want to get text from the last index of "-" till the end of string.
String str = "Country-France-Captal-Paris"; int index = str.lastIndexOf("-"); System.out.println("Capital:" + str.substring(index+1,str.length()));