out.print(new StringBuffer(rs.getString("mobile")).replace(3,7,"****"));
String m=rs.getString("mobile");
out.print(m.substring(0,3)+"****"+m.substring(7,11)+":");
oracle语句实现
select replace(mobile,substr(mobile,4,4),'****') from ins
本文介绍了一种在Java和Oracle环境中对手机号进行脱敏处理的方法。通过使用substring和replace等函数,可以实现在显示手机号时隐藏中间四位数字,仅显示前后部分数字。这种脱敏方式适用于保护用户隐私的场景。
out.print(new StringBuffer(rs.getString("mobile")).replace(3,7,"****"));
String m=rs.getString("mobile");
out.print(m.substring(0,3)+"****"+m.substring(7,11)+":");
select replace(mobile,substr(mobile,4,4),'****') from ins
2138

被折叠的 条评论
为什么被折叠?