using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; namespace PDAForm.Comm { public class MyMath { /// /// 判断是否为整数型 /// /// /// public static bool IsInt(string inString) { Regex regex = new Regex("^[0-9]*[0-9][0-9]*$"); return regex.IsMatch(inString.Trim()); } /// /// 判断是否为浮点型 /// /// /// public static bool IsFloat(string inString) { Regex regex = new Regex(@"^\d*\.?\d*$"); return regex.IsMatch(inString.Trim()); } } }