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
Re: StrDbl and decimal separator [message #8855 is a reply to message #8854] Tue, 03 April 2007 19:03 Go to previous messageGo to previous message
forlano is currently offline  forlano
Messages: 1207
Registered: March 2006
Location: Italy
Senior Contributor
forlano wrote on Tue, 03 April 2007 19:00

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.


EDIT: Just now I found: String decimal_point
Is this the solution and how to use it?
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Unsafe Deep Copy
Next Topic: Value and Serialize
Goto Forum:
  


Current Time: Fri Jul 18 03:48:51 CEST 2025

Total time taken to generate the page: 0.04067 seconds