Java Array Has inArray(String arg, String[] array)

Here you can find the source of inArray(String arg, String[] array)

Description

check if a string is in an array of strings, checking all elements

License

Open Source License

Declaration

public static boolean inArray(String arg, String[] array) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /** check if a string is in an array of strings, checking all elements */
    public static boolean inArray(String arg, String[] array) {
        int i, len;
        boolean res = false;
        len = array.length;/*from   ww w. ja v  a2  s  .  co  m*/
        if (len > 0)
            for (i = 0; i < len; i++) {
                if (arg.equals(array[i]))
                    res = true;
            }
        return res;
    }
}

Related

  1. inArray(final String s, final String[] array)
  2. inArray(final T[] array, final U search)
  3. inArray(int[] arr, int search)
  4. inArray(int[] array, int needle)
  5. inArray(Object[] ps, Object p)
  6. inArray(String needle, String... haystack)
  7. inArray(String str, String[] stringArray)
  8. inArray(String string, String[] strings)
  9. inArray(String value, String[] s)