Java Array Contain arrayContains(String[] arr, String sg, boolean ignoreCase)

Here you can find the source of arrayContains(String[] arr, String sg, boolean ignoreCase)

Description

array Contains

License

Open Source License

Declaration

public static boolean arrayContains(String[] arr, String sg,
            boolean ignoreCase) 

Method Source Code

//package com.java2s;

public class Main {
    public static boolean arrayContains(String[] arr, String sg,
            boolean ignoreCase) {
        for (int i = 0; i < arr.length; i++) {
            if (ignoreCase) {
                if (sg.equalsIgnoreCase(arr[i]))
                    return true;
            } else {
                if (sg.equals(arr[i]))
                    return true;
            }// w w w.j a  v a2s  .  c  o m
        }
        return false;
    }
}

Related

  1. arrayContains(Object[] array, Object element)
  2. ArrayContains(Object[] array, Object obj)
  3. arrayContains(Object[] array, Object object)
  4. arrayContains(Object[] element, Object[][] array)
  5. arrayContains(Object[] haystack, Object needle)
  6. arrayContains(String[] array, String str)
  7. arrayContains(String[] array, String value)
  8. arrayContains(String[] array, String value)
  9. arrayContains(String[] array, String word)