tnblog
首页
视频
资源
登录

字符串格式验证

4841人阅读 2020/3/31 14:56 总访问:347730 评论:0 收藏:0 手机
分类: ASP.NET
  1. 判断字符串是否为null或为空.判断为空操作前先进行了Trim操作。
    public static bool IsNullOrEmpty(this string source)
     {
          return string.IsNullOrEmpty(source);
    }
    判断字符串是否为整型
    public static bool IsInteger(this string source)
            {
                if (string.IsNullOrEmpty(source))
                {
                    return false;
                }
                int i;
                return Int32.TryParse(source, out i);
            }
评价
当你知道迷惑时,并不可怜,当你不知道迷惑时,才是最可怜的。
排名
6
文章
6
粉丝
16
评论
8
{{item.articleTitle}}
{{item.blogName}} : {{item.content}}
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2024TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
欢迎加群交流技术