特殊字符 * ^ : | . 需要用\转义
一、单个符号作为分隔符
String address="北京.北京市.海淀区.普天大厦";
String[] splitAddress=address.split("\.");
System.out.println(splitAddress[0]+splitAddress[1]+splitAddress[2]+splitAddress[3]);
String addressTwo="北京,北京市,海淀区,普天大厦";
String[] splitAddress=addressTwo.split(",");
System.out.println(splitAddress[0]+splitAddress[1]+splitAddress[2]+splitAddress[3]);
二、多个符号作为分隔符
String address="北京.北京市@海淀区#普天大厦";
String[] splitAddress=address.split("\.|@|#");
System.out.println(splitAddress[0]+splitAddress[1]+splitAddress[2]+splitAddress[3]);