public
synchronized int lastIndexOf(String str, int fromIndex)
Return
the index within this sequence of the last occurrence of the
specified substring from the fromIndex.
public class StringBufferLastIndexOf { public static void main(String args[]){ StringBuffer str = new StringBuffer("wertertwertdef"); System.out.print("Last index of \"ert\" is "); System.out.println(str.lastIndexOf("ert", 7)); } }
Output
Last index of "ert" is 4
No comments:
Post a Comment