IdCardKit { public static String[] validateIdCard10(String idCard) { String[] info = new String[3]; String card = idCard.replaceAll("[\\(|\\)]", ""); if (card.length() != 8 && card.length() != 9 && idCard.length() != 10) { return null; } if (idCard.matches("^[a-zA-Z][0-9]{9}$")) { info[0] = "台湾"; System.out.println("11111"); String char2 = idCard.substring(1, 2); if (char2.equals("1")) { info[1] = "M"; System.out.println("MMMMMMM"); } else if (char2.equals("2")) { info[1] = "F"; System.out.println("FFFFFFF"); } else { info[1] = "N"; info[2] = "false"; System.out.println("NNNN"); return info; } info[2] = validateTWCard(idCard) ? "true" : "false"; } else if (idCard.matches("^[1|5|7][0-9]{6}\\(?[0-9A-Z]\\)?$")) { info[0] = "澳门"; info[1] = "N"; } else if (idCard.matches("^[A-Z]{1,2}[0-9]{6}\\(?[0-9A]\\)?$")) { info[0] = "香港"; info[1] = "N"; info[2] = validateHKCard(idCard) ? "true" : "false"; } else { return null; } return info; }  static String conver15CardTo18(String idCard); static boolean validateCard(String idCard); static boolean validateIdCard18(String idCard); static boolean validateIdCard15(String idCard); static String[] validateIdCard10(String idCard); static boolean validateTWCard(String idCard); static boolean validateHKCard(String idCard); static int[] converCharToInt(char[] ca); static int getPowerSum(int[] iArr); static String getCheckCode18(int iSum); static int getAgeByIdCard(String idCard); static String getBirthByIdCard(String idCard); static Short getYearByIdCard(String idCard); static Short getMonthByIdCard(String idCard); static Short getDateByIdCard(String idCard); static String getGenderByIdCard(String idCard); static String getProvinceByIdCard(String idCard); static final int CHINA_ID_MIN_LENGTH; static final int CHINA_ID_MAX_LENGTH; static final String cityCode; static final int power; static final String verifyCode; static final int MIN; static final Map<String, String> cityCodes; static final Map<String, Integer> twFirstCode; static final Map<String, Integer> hkFirstCode; }
@Test public void testValidateIdCard10() throws Exception { }