Here you can find the source of lastIndexOfAny(String string, char[] anyOf)
public static int lastIndexOfAny(String string, char[] anyOf)
//package com.java2s; //License from project: Open Source License public class Main { public static int lastIndexOfAny(String string, char[] anyOf) { int highestIndex = -1; for (char c : anyOf) { int index = string.lastIndexOf(c); if (index > highestIndex) { highestIndex = index;/* ww w.ja va2 s . co m*/ if (index == string.length() - 1) break; } } return highestIndex; } public static int lastIndexOfAny(String string, char[] anyOf, int startIndex) { String substring = string.substring(0, startIndex + 1); int lastIndexInSubstring = lastIndexOfAny(substring, anyOf); if (lastIndexInSubstring < 0) return -1; else return lastIndexInSubstring; } public static int lastIndexOfAny(String string, char[] anyOf, int startIndex, int count) { int leftMost = startIndex + 1 - count; int rightMost = startIndex + 1; String substring = string.substring(leftMost, rightMost); int lastIndexInSubstring = lastIndexOfAny(substring, anyOf); if (lastIndexInSubstring < 0) return -1; else return lastIndexInSubstring + leftMost; } public static int lastIndexOf(String string, char value, int startIndex, int count) { 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; } public static int lastIndexOf(String string, String value, int startIndex, int count) { 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; } public static String substring(String string, int start, int length) { if (length < 0) throw new IndexOutOfBoundsException("Parameter length cannot be negative."); return string.substring(start, start + length); } }