码迷,mamicode.com
首页 > 移动开发 > 详细

Android 隐藏手机号中间四位和隐藏邮箱地址中间四位

时间:2017-04-06 15:46:33      阅读:292      评论:0      收藏:0      [点我收藏+]

标签:android   roi   oid   email   one   static   tin   phone   ring   

/**
* 手机号用****号隐藏中间数字
*
* @param phone
* @return
*/
public static String settingphone(String phone) {
String phone_s = phone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
return phone_s;
}


/**
* 邮箱用****号隐藏前面的字母
*
* @return
*/
public static String settingemail(String email) {
String emails = email.replaceAll("(\\w?)(\\w+)(\\w)(@\\w+\\.[a-z]+(\\.[a-z]+)?)", "$1****$3$4");
return emails;
}

Android 隐藏手机号中间四位和隐藏邮箱地址中间四位

标签:android   roi   oid   email   one   static   tin   phone   ring   

原文地址:http://www.cnblogs.com/lenkevin/p/6673499.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!