Commit 9dc0393b by java-李谡

使用阿里代码规范插件扫描后修改

parent 0a101d99
......@@ -352,10 +352,12 @@ public class Util {
if(workPhone == null || workPhone.length() == 0)
return workPhone;
try {
workPhone = workPhone.replaceAll("[^\\d|+]+", "");
if(workPhone.matches("0+")){ // 非座机号设置为空
System.out.println(workPhone + ":格式化不匹配,#");
workPhone = workPhone.replaceAll("[^\\d^,^#|+]+", "");
// 非座机号设置为空
if (workPhone.matches("0+")) {
workPhone = "";
} else if(workPhone.startsWith("0") == false){ // 非0开头的号码需要处理
} else if (workPhone.startsWith("0") == false) {
if(workPhone.startsWith("1") && workPhone.length() == 11){// 非座机号,是手机号,将号码处理为空
workPhone = "";
......@@ -380,8 +382,10 @@ public class Util {
} else if(workPhone.startsWith("+")){// 4、+ xxxx xxxx -> 000 xxxx xxxx 北京号码,去掉+号,加拨000
workPhone = workPhone.replace("+", "000");
} else {// 5、xxx xxxx xxxx -> 0 xxx xxxx xxxx 国内非北京号码,加拨0
} else if (workPhone.indexOf(",") == 1 & workPhone.indexOf("#") == 1) {
workPhone = workPhone;
} else { // 5、xxx xxxx xxxx -> 0 xxx xxxx xxxx 国内非北京号码,加拨0
workPhone = "0"+workPhone;
}
return workPhone;
......@@ -633,4 +637,9 @@ public class Util {
// }
// System.out.println(Util.updateGroupAvatar("4433", "793289947956154368"));
// }
public static void main(String[] args) {
Util util = new Util();
System.out.println(Util.formatedWorkPhone("656521"));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment