CommonUtil.cs 538 B

1234567891011121314151617181920212223
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. namespace TimedUpload.utils
  7. {
  8. public class CommonUtil
  9. {
  10. /// <summary>
  11. /// 判断字符串是否是数字
  12. /// </summary>
  13. public static bool IsNumber(string s)
  14. {
  15. if (string.IsNullOrWhiteSpace(s)) return false;
  16. const string pattern = "^[0-9]*$";
  17. Regex rx = new Regex(pattern);
  18. return rx.IsMatch(s);
  19. }
  20. }
  21. }