How do I check if a list of characters are in a String, for example “ABCDEFGH” how do I check if any one of those is in a string.
Advertisement
Answer
use regular expression in java to check using str.matches(regex_here)
regex in java
for example:
if("asdhAkldffl".matches(".*[ABCDEFGH].*")) { System.out.println("yes"); }