java tutorial - Java Strings LastIndexOf() method - java programming - learn java - java basics - java for beginners
Learn Java - Java tutorial - Java strings last index of - Java examples - Java programs
Description
LastIndexOf () method The lastIndexOf () method in Java has the following options:
- int lastIndexOf(int ch) — returns the index in the given line of the last occurrence of the specified character or -1 if the character does not occur.
- int intIndexOf (int ch, int fromIndex) - returns the index of the last occurrence of the character in the character string represented by this object, which is less than or equal to fromIndex, or -1 if the character does not occur before this point.
- public int lastIndexOf (String str) - if string argument occurs at least one times in the substring in a given object, and then it will returns index of the initial character of the very last substring.
- public int lastIndexOf (String str, int fromIndex) - returns the index within the given line of the last occurrence of the specified substring, the search is performed back, starting with the specified index.
Syntax
Syntax method:
Options
Detailed information about the parameters:
- ch is a character;
- fromIndex - index to start the search (from);
- str is a string.
Return value
- In Java, lastIndexOf () returns an index.