List of utility methods to do String Last Index Of
int | lastIndexOf(String str, String searchChar) last Index Of if (isEmpty(str)) { return -1; return str.lastIndexOf(searchChar); |
int | lastIndexOf(String str, String substr) last Index Of if (str != null) { return str.lastIndexOf(substr); } else { return -1; |
int | lastIndexOf(String string, char value, int startIndex, int count) last Index Of int leftMost = startIndex + 1 - count; int rightMost = startIndex + 1; String substring = string.substring(leftMost, rightMost); int lastIndexInSubstring = substring.lastIndexOf(value); if (lastIndexInSubstring < 0) return -1; else return lastIndexInSubstring + leftMost; ... |
int | lastIndexOf(String string, char... chars) last Index Of if (string == null) { return -1; return lastIndexOf(string, string.length() - 1, chars); |
int | lastIndexOf(String string, String substring) Reimplementation of lastIndexOf from String class to make it work indepent of the platform used.
int len = string.length(); while (len >= -1) { if (string.startsWith(substring, len)) { return len; len--; return len; ... |
int | lastIndexOf(String text, int startPos, String... searchStrings) last Index Of int bestPos = -1; for (String i : searchStrings) { int pos = text.lastIndexOf(i, startPos); if (pos >= 0) { if ((bestPos < 0) || (pos > bestPos)) { bestPos = pos; return bestPos; |
int | lastIndexOf(String text, String key, int num) last Index Of int index = -1; int fromIndex = text.length() - 1; for (int i = 0; i < num; i++) { index = text.lastIndexOf(key, fromIndex); fromIndex = index - 1; return index; |
int | lastIndexOf(String what, String within) last Index Of if (what == null || within == null || what.length() == 0) { return -1; int i = 0; int lastI = -1; while ((i = within.indexOf(what, i)) != -1) { lastI = i++; return lastI; |
int | lastIndexOf(StringBuffer buf, String str) Performs the equivalent of buf.toString().lastIndexOf(str), but is much more memory efficient. return lastIndexOf(buf, str, buf.length());
|
int | lastIndexOfAny(final String delimiters, final String str) last Index Of Any for (int i = str.length() - 1; i >= 0; --i) { if (delimiters.indexOf(str.charAt(i)) >= 0) { return i; return -1; |