C# 验证数字
/// <summary>
/// 验证数字
/// </summary>
/// <param name="number">数字内容</param>
/// <returns>true 验证成功 false 验证失败</returns>
public bool CheckNumber(string number)
{
if (string.IsNullOrEmpty(number))
{
return false;
}
Regex regex = new Regex(@"^(-)?\d+(\.\d+)?$");
if (regex.IsMatch(number))
{
return true;
}
else
{
return false;
}
}
C# 验证数字的更多相关文章
- [LeetCode] Valid Number 验证数字
Validate if a given string is numeric. Some examples:"0" => true" 0.1 " => ...
- JS正则表达式验证数字
<script type="text/javascript"> function validate(){ var reg = new RegExp("^[0- ...
- JS正则表达式验证数字(很全)
1.<script type="text/javascript"> 2. function validate(){ 3. var reg = new ...
- JS正则表达式验证数字非常全
<script type="text/javascript"> function validate(){ var reg = new RegExp("^[0- ...
- JavaScript 【正则表达式验证数字代码】
可以看到 Ajax 请求多了个 x-requested-with ,可以利用它,request.getHeader("x-requested-with"); 为 null,则为传统 ...
- 正则表达式验证数字、汉字、电话号码,email,整数,浮点数
验证数字的正则表达式集 验证数字:^[0-9]*$验证n位的数字:^\d{n}$验证至少n位数字:^\d{n,}$验证m-n位的数字:^\d{m,n}$验证零和非零开头的数字:^(0|[1-9][0- ...
- Atitit 验证 数字验证 非空验证的最佳算法 h5
Atitit 验证 数字验证 非空验证的最佳算法 h5 <td><select class="searchBox-select" style=" ...
- 黄聪:JS正则表达式验证数字
<script type="text/JavaScript"> function validate(){ var reg = new RegExp( ...
- Valid Number 验证数字
Validate if a given string is numeric. Some examples:"0" => true" 0.1 " => ...
随机推荐
- mybatis框架源码学习
转:来自https://my.oschina.net/u/1458864/blog/293659 摘要:初始化mybatis,所有的配置都在configuation 对象中使用mybatis,从sql ...
- sping时间触发器
而在Spring里很好的集成了Quartz,在xml文件里面配一下时间就可以自动执行,不需要写一行代码. <bean id="methodInvokingJobDetail" ...
- Linux下的两个聊天命令的使用方法
一. write用法:write 用户名:敲回车后,自己和对方将会同时处于聊天的状态,但是被发起连接的人只能收到发起聊天请求的人的聊天内容,但是不能回复,如果想要回复的话必须先向对方发起连接,这样以来 ...
- PHP关于表单提交 后 post get分页
PHP关于表单提交后分页函数的那点事--POST表单分页实现 phpfunctionclass加密inputjavascript 说到分页,其实你在Google一搜一大把.大部是通过GET ...
- hdu_5683_zxa and xor(非正解的暴力)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=5683 题意: 问题描述 zxa最近对按位异或(exclusive disjunction)产生了极大的 ...
- UIImageView 在切图规范的情况下不用设置frame
UIImageView本身是没有frame的,所以UIImageView不用设置frame,UIImageView的fram由它内部的图片决定,所以当要更改UIImageView的大小显示的时候,更改 ...
- 为PO手写添加配置文件(hbm.xml)
- code.google.com
https://github.com/couchbase/sync_gateway/issues/492 This list shows the current base import paths, ...
- js中Object.__proto__===Function.prototype
参考:http://stackoverflow.com/questions/650764/how-does-proto-differ-from-constructor-prototype http:/ ...
- ng-init小解
ng-init可有多个表达式 ng-init= "a= 1;b= 2" 在这里头定义的变量会加入scope作用域 ng-init只能加入不必要的简单逻辑,输入alert() 定义数 ...