public
int indexOf(int ch, int fromIndex)
Returns
the index within this string of the first occurrence of the specified
character, starting the search at the specified index.
class StringIndexOfFrom{ public static void main(String args[]){ String s1 = new String("wxyzbab"); System.out.println("s1 = " + s1); System.out.print("Character b at index "); System.out.println(s1.indexOf('b', 5)); } }
Output
s1 = wxyzbab Character b at index 6
No comments:
Post a Comment