-
-
-
-
-
- public static bool IsInteger(string s)
- {
- string pattern = @"^\d*$";
- return Regex.IsMatch(s,pattern);
- }
- /// <summary>
-
-
-
-
- public static bool IsNumber(string s)
- {
- return IsNumber(s,32,0);
- }
- /// <summary>
-
-
-
-
-
-
- public static bool IsNumber(string s,int precision,int scale)
- {
- if((precision == 0)&&(scale == 0))
- {
- return false;
- }
- string pattern = @"(^\d{1,"+precision+"}";
- if(scale>0)
- {
- pattern += @"\.\d{0,"+scale+"}$)|"+pattern;
- }
- pattern += "$)";
- return Regex.IsMatch(s,pattern);
- }
|