Java String Last Index Of lastIndexOfAny(String str, String search, int offset)

Here you can find the source of lastIndexOfAny(String str, String search, int offset)

Description

last Index Of Any

License

Open Source License

Declaration

public static int lastIndexOfAny(String str, String search, int offset) 

Method Source Code

//package com.java2s;

public class Main {
    public static int lastIndexOfAny(String str, String search, int offset) {
        if (str.equals("") || search.equals("")) {
            return -1;
        }/*from   w w w  . j  av  a2  s .  com*/
        for (int i = str.length(), strCodepoint; i > 0; i -= Character.charCount(strCodepoint)) {
            strCodepoint = str.codePointBefore(i);
            for (int j = search.length(), searchCodepoint; j > 0; j -= Character.charCount(searchCodepoint)) {
                searchCodepoint = search.codePointBefore(j);
                if (strCodepoint == searchCodepoint) {
                    return i;
                }
            }
        }
        return -1;
    }
}

Related

  1. lastIndexOf(String text, int startPos, String... searchStrings)
  2. lastIndexOf(String text, String key, int num)
  3. lastIndexOf(String what, String within)
  4. lastIndexOf(StringBuffer buf, String str)
  5. lastIndexOfAny(final String delimiters, final String str)
  6. lastIndexOfAnyBut(String srcString, String validString)
  7. lastIndexOfAnyDelimiter(String str, int fromIndex, String delimiters)
  8. lastIndexOfIgnoreCase(String pString, String pLookFor)
  9. lastIndexOfIgnoreCase(String s, String substr)