Home » java » indexof and lastindexof

indexof and lastindexof

indexOf(int ch) returns int value that is the first occurrence of specified character in given string. Counting start from 0. If character not found it returns -1
indexOf(int ch, int fromIndex) returns int value that is the first occurrence of specified character in given string after specified position. If character not found it returns -1.
lastIndexOf(int ch)return int value that is last occurrence of specified character.
public int lastIndexOf(int ch,int fromIndex) Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index

Please follow and like us:
error