[java]代码库
import java.util.Scanner;
public class shengfenzheng {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
System.out.println("输入身份证号码: ");
String str = scan.nextLine().trim();
scan.close();
String a = str.substring(0,2);//2
String b= str.substring(2,4);//2
String c = str.substring(4,6);//2
String d = str.substring(6,10);//4
String e = str.substring(10,12);//2
String f = str.substring(12,14);//2
String g = str.substring(14,16);//2
String h = str.substring(16,17);//1
String i = str.substring(17,18);//1
System.out.println("所在省份代码:" + a);
System.out.println("所在城市代码:" + b);
System.out.println("所在区县代码:" + c);
System.out.println("出生年月日: " + d+ ", " + e+","+f);
System.out.println("所在地派出所代码:" + g);
System.out.println("性别:" + h);
System.out.println("校验码:" + i);
}
}