0

This is a strange one, on most of my systems this code works fine:

var separator = Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator);
DA = Math.Round(double.Parse(M.Groups[1].Value.Replace('.', separator))).ToString();

It brings back a digit like for example: 12.6754645644 so we just round up the M.Groups[1].Value to 12 for example, although it works on most systems in 1 it is throwing an error:

System.FormatException: Input string was not in a correct format. at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)

The strange thing is, it works on most systems I have tested on, is there something I am missing here?

Mike G
  • 4,232
  • 9
  • 40
  • 66
graham23s
  • 385
  • 3
  • 14
  • 1
    What do you expect this code to do? (I suspect you trying to hack something like `double.Parse("1.234", CultureInfo.InvariantCulture)`, but I'm not sure). – Alexei Levenkov Nov 18 '15 at 19:03
  • Hi, yeah i'm just rounding the digit up to 1 for example and cut off everything after the "." – graham23s Nov 18 '15 at 19:05

0 Answers0