Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { /** * Determines if a substring in an array of strings is present in at least one string of that * array. String substring is the substring to search for. * * @param list The list of elements to use * @param substring The substring to search for in the list * @param caseinsensitive If true, ignore upper/lowercase distinctions. * * @return boolean True if we found a matching substring in the specified list. * */ public static boolean listElementContains(String[] list, String substring, boolean caseinsensitive) { if (caseinsensitive) { substring = substring.toLowerCase(); for (String s : list) if (s.toLowerCase().contains(substring)) return true; return false; } else { for (String s : list) if (s.contains(substring)) return true; return false; } } }