VAGSuite.MapViewerEx.ConvertToDouble C# (CSharp) Méthode

ConvertToDouble() private méthode

private ConvertToDouble ( string v ) : double
v string
Résultat double
        private double ConvertToDouble(string v)
        {
            double d = 0;
            string newv = string.Empty;
            foreach (char c in v)
            {
                if (c == ',' || c == '.') newv += c;
                else if (c >= 0x30 && c <= 0x39) newv += c;
                else if (c == 'A' || c == 'a') newv += c;
                else if (c == 'B' || c == 'b') newv += c;
                else if (c == 'C' || c == 'c') newv += c;
                else if (c == 'D' || c == 'd') newv += c;
                else if (c == 'E' || c == 'e') newv += c;
                else if (c == 'F' || c == 'f') newv += c;
            }
            if (newv == "") return d;
            string vs = "";
            vs = newv.Replace(System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberGroupSeparator, System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);
            Double.TryParse(vs, out d);
            return d;
        }
MapViewerEx