判断输入的值是否为Double

using System;
using System.Collections.Generic;
using System.Text;

namespace TDRFactory
{
    public class Util
    {

        //判断输入是否为double,不是则返回true
        public static bool isNotDouble(string str)
        {
            bool flag = false;
            if (str.StartsWith(".") || str.EndsWith("."))
            {
                flag = true;
            }
            else
            {
                for (int i = 0; i < str.Length; i++)
                {
                    if (!(char.IsDigit(str,i) || str[i].Equals('.')))
                    {
                        flag = true;
                        break;
                    }
                }
               
            }
            return flag;
        }
    }
}
原文地址:https://www.cnblogs.com/xcxcxcxc/p/5541214.html