Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Internationalization / September 2007

Tip: Looking for answers? Try searching our database.

double.Parse and NumberFormat behavior

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
schaf@2wire.ch - 06 Sep 2007 08:10 GMT
Hi NG!
I have a little question about the localization of a double.

If I use the CultureInfo "en-US" I have the following behavior:

1.) If I enter the value 2.5 into a textbox the
double.Parse(text1.Text) returns 2.5 as expected.
2.) If I enter the value 2,5 into a textbox the
double.Parse(text1.Text) returns 25...why 25 and not 2500. The , is
the group-separator.

Is it possible to ignore these behavior to ensure the 2,5 and 2.5 will
always be interpreted as 2.5 9like in the calculator) ? Or do I have
to implement this behavior by my self?

Regards
Marcel
Michael S. Kaplan [MSFT] - 10 Sep 2007 01:46 GMT
There is no place I know of that treats the grouping separator as something
that implies missing zeros are there....

But in any case, the parsing behavior is designed to do culture-specific
formatting. If you want it to do something different then you have to parse
it yourself....

Signature

MichKa [Microsoft]
Fundamentals Technical Lead
Windows International
Blog: http://blogs.msdn.com/michkap

This posting is provided "AS IS" with
no warranties, and confers no rights.

> Hi NG!
> I have a little question about the localization of a double.
[quoted text clipped - 13 lines]
> Regards
> Marcel

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.