?
Solved

How to avvoid international decimal point problems

Posted on 2001-09-03
7
Medium Priority
?
646 Views
Last Modified: 2007-12-19
I was running my application which had originally been built on a Computer with English setup on a Norwegian one, where the decimal point is "," (comma) and not "." (point).

Therefore my application produced an error saying that "7.5" was not a correct Float.

Changing the International settings to English (US) and rebooting solved the problems - but there must be an internal and better way to solve the problem in Delphi.

Isn't it?
0
Comment
Question by:bjornborg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 7

Expert Comment

by:Motaz
ID: 6450208
But '.' in DecimalSeparator variable:

DecimalSeparator:= '.';

This will ignore system's current settings
Motaz
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6450209
seems you've a hardcoded interpunction in this app

normally, the numberformatting depends on the local-regional settings.

to get it work you can adjust applicationwide the interpunction at startup of your app

well, have this not in mind which exact,
but look into the delphi online-help
(as entry you could search for shortdateformat
(well its not this what you a searching, but after you've find it you will also see the variablnames for the interpunction))

meikl ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6450211
thanks motaz :-)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:bjornborg
ID: 6450667
Thank you, in this case I get the value from an external program, and I guess I can do a Find/Replace on the string that I receive (e.g '7.5') before I convert it to a Float.

I have seen another message somewhere that there is a way to read the international settings from the System.

BUT: It must be possible to modify the way Delphi is supposed to understand external input to make sure that even "wrong" number values are interpreted correctly ??

0
 

Author Comment

by:bjornborg
ID: 6450678
..oops: I guess the solution is what Motaz was suggesting - will have to try that when I am back on my machine with Delphi again to try using "DecimalSeparator"
0
 

Author Comment

by:bjornborg
ID: 6459844
I found the "DecimalSeparator" settings in the BDE Administrator tool, but this is not really what I was looking for.

In my case I am not using a database, but I receive the number (as a string) from another application. What I would like Delphi to be able to do, is to be able to understand the input (no matter which setting the PC has) so that 7.5 is accepted as a number even when run on a machine with European setup.

In my previous world I used to be able to define application.decimalseparator, and this would override the PCsystem.decimalseparator settings.

Bjorn
0
 
LVL 7

Accepted Solution

by:
Motaz earned 150 total points
ID: 6460168
I mean DecimalSeperator global variable, just write:

DecimalSeperator:= '.'; at OnCreate event of your main form.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question