/// <summary>
        /// 验证合法输入 (.0123456789)
        /// </summary>
        /// <param name="strCode">待验证字符串</param>
        /// <returns></returns>
        public bool IsNumeric(string strCode)
        {
            if (strCode == null || strCode.Length == 0)
                return false;
            ASCIIEncoding ascii = new ASCIIEncoding();
            byte[] byteStr = ascii.GetBytes(strCode);
            foreach (byte code in byteStr)
            {
                //验证 .--46  0--48  1--49 9--57
                if (code < 46 || code > 57)
                        return false;
        if (code ==47)
            return false;
            }
            return true;
        }

posted on 2009-08-24 14:43  秋波渡  阅读(242)  评论(0编辑  收藏  举报