Here you can find the source of containsAnyIgnoreCase(String string, Collection
Parameter | Description |
---|---|
string | the string to check, can be null. |
searchStrings | the strings to check against. |
public static boolean containsAnyIgnoreCase(String string, Collection<String> searchStrings)
//package com.java2s; import java.util.Collection; public class Main { /**//from ww w. j a v a2 s . c o m * Indicates whether the given string contains any of the given search * strings. The operation ignores case and leading and trailing blanks. * * @param string the string to check, can be null. * @param searchStrings the strings to check against. * @return true or false. */ public static boolean containsAnyIgnoreCase(String string, Collection<String> searchStrings) { if (string == null || searchStrings == null) { return false; } for (String searchString : searchStrings) { if (string.trim().toLowerCase() .contains(searchString.trim().toLowerCase())) { return true; } } return false; } }