如:手机号15807892578 隐藏中间四位结果为:158****2578

在代码中可以使用字符串提供的replace函数实现替换即可:

注意:\n和$n的区别: \n是写在正则表达式中的,代表引用正则表达式中第n个括号中的内容。 $n一般是在字符串的替换函数replace中使用到,替换满足正则条件的字符串。
如:手机号15807892578 隐藏中间四位结果为:158****2578
在代码中可以使用字符串提供的replace函数实现替换即可:
注意:\n和$n的区别: \n是写在正则表达式中的,代表引用正则表达式中第n个括号中的内容。 $n一般是在字符串的替换函数replace中使用到,替换满足正则条件的字符串。
本文标题:手机号隐藏中间4位
本文链接:https://www.haomeiwen.com/subject/fznrmftx.html
网友评论