如题所述
第1个回答 2016-08-09
String reg1 = ".*性别:([^\\|]*)\\|?.*";
String reg2 = ".*民族:([^\\|]*)\\|?.*";
String reg3 = ".*生日:([^\\|]*)\\|?.*";
String str = "性别:女士|民族:汉族|生日:1990-9-22";
String sex = str.replaceAll(reg1, "$1");
String mz = str.replaceAll(reg2, "$1");
String brith = str.replaceAll(reg3, "$1");
System.out.println (sex);
System.out.println (mz);
System.out.println (brith);
String reg2 = ".*民族:([^\\|]*)\\|?.*";
String reg3 = ".*生日:([^\\|]*)\\|?.*";
String str = "性别:女士|民族:汉族|生日:1990-9-22";
String sex = str.replaceAll(reg1, "$1");
String mz = str.replaceAll(reg2, "$1");
String brith = str.replaceAll(reg3, "$1");
System.out.println (sex);
System.out.println (mz);
System.out.println (brith);
第2个回答 2016-08-09
String string = 原字符串.substring(int start,int end);
第3个回答 2016-08-09
String str = "房估字(2014)第YPQD0006号";
String jieguo = str.substring(str.indexOf("第")+1,str.indexOf("号"));本回答被提问者采纳
String jieguo = str.substring(str.indexOf("第")+1,str.indexOf("号"));本回答被提问者采纳