using System.Text.RegularExpressions; namespace DownKyi.Core.Utils.Validator { public static class Number { /// /// 字符串转数字(长整型) /// /// /// public static long GetInt(string value) { return IsInt(value) ? long.Parse(value) : -1; } /// /// 是否为数字 /// /// /// public static bool IsInt(string value) { return Regex.IsMatch(value, @"^\d+$"); } } }