simple type Conversion from string to double
-
Hi, I have a very simple, yet nagging problem. I am trying to convert some string containing numbers and dots to double. The thing is that double convert (Convert.ToDouble) crashes if the string to convert contains a dot (e.g. "10.10") Can you please help me around this problem. Thanks:confused: Krugger
-
Hi, I have a very simple, yet nagging problem. I am trying to convert some string containing numbers and dots to double. The thing is that double convert (Convert.ToDouble) crashes if the string to convert contains a dot (e.g. "10.10") Can you please help me around this problem. Thanks:confused: Krugger
You're probably running the code on a machine where the standard culture of the OS and consequently of your application usually use another decimal separator (e.g. in german os the comma), so you have to use an overload that takes an
IFormatProvider
providing proper culture-specific formatting information.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
-
Hi, I have a very simple, yet nagging problem. I am trying to convert some string containing numbers and dots to double. The thing is that double convert (Convert.ToDouble) crashes if the string to convert contains a dot (e.g. "10.10") Can you please help me around this problem. Thanks:confused: Krugger
Simple try this string str = "10.23"; double db; db=Double.Parse(str); i think it might help you :)
Thanks and Regards Sandeep If you want something you never had, do something you have never done!
-
You're probably running the code on a machine where the standard culture of the OS and consequently of your application usually use another decimal separator (e.g. in german os the comma), so you have to use an overload that takes an
IFormatProvider
providing proper culture-specific formatting information.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
Thank you. In fact, i just figured it out myself but thank you for the tip. It indeed has to do with the locale. :) Krugger
-
Thank you. In fact, i just figured it out myself but thank you for the tip. It indeed has to do with the locale. :) Krugger