String empId;
我想检查一下empId是否符合模式" L101"
答案 0 :(得分:0)
public class A {
public static void main(String[] args) {
System.out.println(isValidEmpId("L101324", "L101"));
}
private static boolean isValidEmpId(String empId, String pattern) {
boolean isMatch = false;
if (empId.indexOf(pattern) != -1) {
isMatch = true;
} else {
isMatch = false;
}
return isMatch;
}
}