/// <summary>
        /// 验证是否为纯数字
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static bool IsNumeric(string str)
        {
            if (str == null || str.Length == 0)
                return false;
            ASCIIEncoding ascii = new ASCIIEncoding();
            byte[] bytestr = ascii.GetBytes(str);

            foreach (byte c in bytestr)
            {
                if (c < 48 || c > 57)
                {
                    return false;
                }
            }
            return true;
        }

 

相关文章:

  • 2022-02-13
  • 2022-12-23
  • 2022-12-23
  • 2022-02-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-24
  • 2021-12-17
猜你喜欢
  • 2022-12-23
  • 2021-09-10
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
相关资源
相似解决方案