如何验证号码 [英] how to validate number
本文介绍了如何验证号码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想检查整个字符串是否为数字,还检查整个字符串是否有特殊字符.plz帮助我吗?
i want to check whole string is number or not and also check whole string has special character or not.plz help me?
推荐答案
我建议你使用 Regex [ ^ ] - Regex.IsMatch方法 [ ^ ]。
如需进一步了解,请参阅:
正则表达式语言 - 快速参考 [ ^ ]
正则表达式中的量词 [ ^ ]
示例模式:
http://www.regular-expressions.info/examples.html [ ^ ]
I would suggest you to use Regex[^] - Regex.IsMatch Method[^].
For further infromation, please, see:
Regular Expression Language - Quick Reference[^]
Quantifiers in Regular Expressions[^]
Example patterns:
http://www.regular-expressions.info/examples.html[^]
<asp:textbox id="VisitorContacttxt" runat="server" cssclass="TextBox" maxlength="10" xmlns:asp="#unknown"></asp:textbox>
<asp:filteredtextboxextender id="VisitorContacttxt_FilteredTextBoxExtender" runat="server" xmlns:asp="#unknown">
FilterMode="ValidChars" FilterType="Numbers" TargetControlID="VisitorContacttxt">
</asp:filteredtextboxextender>
Use filteredtextboxextender for enter number or symbol
使用正则表达式验证器....
use Regular Expression validator....
这篇关于如何验证号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文