幽梦紫曦

字符串格式验证

电脑版发表于:2020/3/31 14:56
  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);
            }
关于TNBLOG
TNBLOG,技术分享。技术交流:群号677373950
ICP备案 :渝ICP备18016597号-1
App store Android
精彩评论
{{item.replyName}}
{{item.content}}
{{item.time}}
{{subpj.replyName}}
@{{subpj.beReplyName}}{{subpj.content}}
{{subpj.time}}
猜你喜欢