Visual Studio 2005 c#.net代码项目中电话号码的验证码 [英] validation code for phone number in visual studio 2005 c#.net code project

查看:121
本文介绍了Visual Studio 2005 c#.net代码项目中电话号码的验证码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio 2005中电话号码的验证代码c#.net代码项目

validation code for phone number in visual studio 2005 c#.net code project

推荐答案

您可以通过多种方法来完成电话号码验证,从正则表达式到字符串检查,但是它们都将遭受相同的问题.您尚未在此处定义要验证的电话号码格式.在英国,这里的电话号码与美国电话号码的格式不同,因此,在这里工作的方法对于验证美国号码绝对是没有用的.
There are many ways you can accomplish phone number validation, from regular expressions through to string checking, but they are all going to suffer from the same problem. You haven''t defined here what format of phone numbers you want to validate. A phone number here, in the UK, is a different format to a US phone number, so what works here would be absolutely no use to validating a US number.


Regex是一个选项,如果您将输入与您所在国家/地区的电话格式的有效正则表达式公式进行比较,那将是一个好方法.

就像Pete所说的那样,您需要定义要验证的号码的格式.
Regex is an option, if you compare the input with a valid regex formula for the telephone format of your country then that would be a good way.

Like Pete said, you need define a format of the numbers you want to validate.


我找到了一篇很好的电话号码验证文章.

希望对您有所帮助:)


http://blog.stevenlevithan.com/archives/validate-phone-number
I have found a very good article for phone number validation.

hope it helps :)


http://blog.stevenlevithan.com/archives/validate-phone-number


这篇关于Visual Studio 2005 c#.net代码项目中电话号码的验证码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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