Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

C#, string to double

Name: Anonymous 2011-03-10 9:20

Ok guys i am having a wierd problem, i am trying to convert simple decimal numbers (1.002, 10.3232) from string to double.

But Double.Parse and convert.ToDouble both return non decimals
1.002 = 1002
10.3232 = 103232

Anybody knows the problem here?

Name: Anonymous 2011-03-10 9:35

Sounds like a locale problem.

Name: Anonymous 2011-03-10 9:47

>>2
Yeah, OP should pass CultureInfo.InvariantCulture to double.Parse or commas instead of decimal points.

Also, one can save time by writing a context-manager for setting and restoring Thread.CultureInfo, to be used as using (InvariantCulture()) { ... }

Name: Anonymous 2011-03-10 9:50

>>2
>>3
Yep that was it thx guys

Name: Anonymous 2011-03-10 10:06

Well, this was odd. Now what do we do with this thread?

Name: Anonymous 2011-03-10 10:07

>>5
Let's act retarded xD

Name: Anonymous 2011-03-10 10:27

This thread confuses and infuriates me.

Name: Anonymous 2011-03-10 11:46

thx >>7 i came on cat she hiss at penis

Don't change these.
Name: Email:
Entire Thread Thread List