Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » StrDbl and decimal separator
StrDbl and decimal separator [message #8854] Tue, 03 April 2007 19:00 Go to previous message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

recently I had a bad experience during the parse of a file containing double under Linux. In fact the environment used the "," as decimal separator (very stupid Italian custom and maybe of some other country). So the program wrote its double with "," and successively StrDbl failed to read them. In fact
0,5 1,0 became as the integers 0 and 1. This produced weird results all around. The question is: how to avoid this misunderstanding?

Of course one is to say in advance to the user to set differently the decimal separator. But this is cumbersome because the user really need that stupid sign for other reason and switching each time is not good.

Perhaps it is enough to force the program to save its double with the "." irrispective of the environment. Is it possible?
Any other solution is welcome.

Luigi

PS: to read the numbers in the line :
0,5  1,0

I use Split because the numbers in the row may change. So I've in this case two strings to convert in double. Perhaps there is safer way to read them.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Unsafe Deep Copy
Next Topic: Value and Serialize
Goto Forum:
  


Current Time: Tue May 14 09:03:30 CEST 2024

Total time taken to generate the page: 0.01351 seconds