java list集合包含字符串
StringBuilder studentString = new StringBuilder();
if (!CommonFunctions.isEmpty(studentInfoList)) {
for (CertInfo ci : studentInfoList) {
String student = ci.getstudentNo();
studentString.append(student).append(", ");
}
if (studentString.length() > 0) {
studentString.setLength(studentString.length() - 2);
}
}
String substringToFind = "23";
boolean containsSubstring = studentString.toString().contains(substringToFind);
if (containsSubstring) {
System.out.println("The main string contains the substring.");
} else {
System.out.println("The main string does not contain the substring.");
}