Here you can find the source of arrayContains(String[] array, String word)
Parameter | Description |
---|---|
array | the array to check |
word | the string to look for |
public static boolean arrayContains(String[] array, String word)
//package com.java2s; //License from project: BSD License public class Main { /**/* w w w . j a v a 2 s . com*/ * Returns whether or not a string can be found in an array of strings. * * @param array the array to check * @param word the string to look for * @return true if found, false otherwise */ public static boolean arrayContains(String[] array, String word) { if (array == null) return false; for (String element : array) if (element.equalsIgnoreCase(word)) return true; return false; } }