替换电话号码的国家/地区代码 [英] Replace country code of phone number

查看:96
本文介绍了替换电话号码的国家/地区代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面包含国内和国际电话号码.我想用空格替换唯一的国家/地区代码部分.
那么,对于我应该使用任何正则表达式还是c#代码代替国家/地区代码,您可以帮我吗?
在此先谢谢您.

My page contains national and international phone numbers.I want to replace the only the country code part with blank space.
So can you help me whether i should use any regular expression or c# code to replace country code ?

Thanks in advance.

推荐答案

此处 [
Start here[^] - good source of regular expressions.


大家好,

我在这里变得有点混乱.
我想通过电话号码搜索员工的详细信息.因此,当我搜索包含国家或地区代码的结果时,是否给出相同的结果.

谢谢.
Hi all,

I became little bit messy here.
I want to search details of employee through phone number.So when i search though it contain country code or not gave the same result.

Thanks.


将国家/地区代码替换为空格-

phoneNumber = Regex.Replace(phoneNumber,"\\ + [0-9] {1,}",");

例如:+ 12-122-456-3245
你会得到-122-456-3245
Replace the country code with blank space-

phoneNumber = Regex.Replace(phoneNumber, "\\+[0-9]{1,}", "");

ex:+12-122-456-3245
You get -122-456-3245


这篇关于替换电话号码的国家/地区代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆