public
int lastIndexOf(String str, int fromIndex)
return
the index of the last occurrence of the specified substring,
searching backward from the specified index, or -1 if there is no
such occurrence.
class StringLastIndexOfStr1{ public static void main(String args[]){ String s1 = "wxyzabdabdda"; System.out.print("Last index of \"da\" is : "); System.out.println(s1.lastIndexOf("da", 8)); } }
Output
Last index of "da" is : 6
No comments:
Post a Comment