Java Array Last Index Of lastIndexOfAny(String str, char[] targets)

Here you can find the source of lastIndexOfAny(String str, char[] targets)

Description

last Index Of Any

License

Apache License

Declaration

public static int lastIndexOfAny(String str, char[] targets) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static int lastIndexOfAny(String str, char[] targets) {
        int result = -1;
        for (int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            for (char target : targets) {
                if (ch == target) {
                    result = i;//from  w  w w .  j  av  a 2 s  .  c  om
                    break;
                }
            }
        }
        return result;
    }
}

Related

  1. lastIndexOf(String str, String[] path)
  2. lastIndexOf(T[] array, T valueToFind, int startIndex)
  3. lastIndexOfAny(byte[] values, byte[] array)
  4. LastIndexOfAny(String str, char[] search)
  5. lastIndexOfAny(String str, char[] searchChars, int startPos)
  6. lastIndexOfAny(String str, String[] searchStrs)
  7. lastIndexOfAny(String str, String[] searchStrs)
  8. lastIndexOfAny(String str, String[] searchStrs)
  9. lastIndexOfAny(String string, char[] anyOf)