Here you can find the source of lastIndexOfAnyBut(String srcString, String validString)
public static int lastIndexOfAnyBut(String srcString, String validString)
//package com.java2s; /******************************************************************************* * Copyright ? 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which is available at/*from w w w .ja v a 2s. c om*/ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ public class Main { public static int lastIndexOfAnyBut(String srcString, String validString) { int result = -1; int srcLen = srcString.length(); // walk backward to find if a char within srcString is in validString for (int i = srcLen - 1; i >= 0; i--) { // not found, stop it if (validString.indexOf(srcString.charAt(i)) == -1) { result = i; break; } } return result; } }