String str = "The quick brown fox jumps over the lazy dog"; String substr = "fox"; boolean contains = StringUtils.containsIgnoreCase(str, substr); System.out.println(contains); // true
ListIn both examples, we use the StringUtils.containsIgnoreCase method to check if a String or a List of Strings contains a specified substring ignoring case considerations. The package library for StringUtils is org.apache.commons.lang3.list = Arrays.asList("apple", "banana", "cherry", "date"); String value = "Banana"; boolean contains = list.stream() .anyMatch(str -> StringUtils.containsIgnoreCase(str, value)); System.out.println(contains); // true