List of utility methods to do String Last Index Of
int | lastIndexOf(char ch, String str) last Index Of if (str.charAt(str.length() - 1) == ch) { return str.length() - 1; if (str.length() <= 1) { return -1; return lastIndexOf(ch, str.substring(0, str.length() - 1)); |
int | lastIndexof(char chr, int pos, CharSequence str) Charsequence util - lastIndexOf int rollPos; for (rollPos = pos - 1; rollPos > -1; rollPos--) { if (str.charAt(rollPos) == chr) break; return rollPos; |
int | lastIndexOf(CharSequence chars, String searched) last Index Of return lastIndexOf(chars, searched, chars.length(), false);
|
int | lastIndexOf(CharSequence charSeq, char ch) last Index Of if (charSeq == null) { return -1; return lastIndexOf(charSeq, ch, charSeq.length() - 1); |
int | lastIndexOf(CharSequence cs, int searchChar, int start) Finds the last index in the CharSequence that matches the specified character. if (cs instanceof String) { return ((String) cs).lastIndexOf(searchChar, start); } else { int sz = cs.length(); if (start < 0) { return -1; if (start >= sz) { ... |
int | lastIndexOf(CharSequence haystack, char needle) Replacement for StringBuilder.lastIndexOf() which does a lot of object creation and copying to achieve this. int len = haystack.length(); if (haystack == null || len == 0) return -1; for (int i = (len - 1); i > 0; i--) { if (haystack.charAt(i) == needle) return i; return -1; ... |
int | lastIndexOf(CharSequence s, char c, int start, int end) Returns the index within this string of the last occurrence of the specified char, searching in specified range start = Math.max(start, 0); for (int i = Math.min(end, s.length()) - 1; i >= start; i--) { if (s.charAt(i) == c) { return i; return -1; |
int | lastIndexOf(CharSequence s, CharSequence seq) Behaves like String.lastIndexOf but for CharSequence .
return indexOf(s, seq, s.length() - 1, false);
|
int | lastIndexOf(CharSequence theChars, CharSequence theSearch) Returns the last index of given search chars in given chars. int cpos = theChars.length() - theSearch.length() + 1; char fchar = theSearch.charAt(0); while (--cpos >= 0) { if (theChars.charAt(cpos) == fchar) { int i = 0; for (i = 0; i < theSearch.length(); i++) if (theChars.charAt(cpos + i) != theSearch.charAt(i)) break; ... |
int | lastIndexOf(final CharSequence cs, final CharSequence searchChar, final int start) Used by the lastIndexOf(CharSequence methods) as a green implementation of lastIndexOf return cs.toString().lastIndexOf(searchChar.toString(), start);
|