how to check if a string contains a specific character in java code example
Example 1: string contains specific word in java
str_Sample.contains("Example"));
Example 2: java if string contains character
if (string.contains(character)
Example 3: how to check if a string contains a character
public static boolean containsIgnoreCase(String str, char c) {
str = str.toLowerCase();
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) == Character.toLowerCase(c)) {
return true;
}
}
return false;
}