To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 6381
6380  |  6382
Subject: 
Re: Delphi and decimal signs.
Newsgroups: 
lugnet.cad.dev
Date: 
Mon, 20 Aug 2001 20:18:15 GMT
Viewed: 
768 times
  
Anders Isaksson wrote:
If you want to have this format in the data files, but show numbers on • screen
as the National Settings suggest, you'll have a much bigger job - you have • to
create your own MyIntToStr, MyFloatToStr, MyStrToFloat etc. etc. and hunt
until doomsday through your code before you have found out where to use • your
own routines, and where to use the builtin.


I would attack the problem thusly:

Upon application startup, record the locale-specific decimal separator
variable into a global variable named UIDecimalSeparator.


Create wrappers for FloatToStr and StrToFloat thusly:


FloatToDataStr

(change DecimalSeparator to '.' then call FloatToStr)

FloatToUIStr

(change DecimalSeparator to UIDecimalSeparator then call FloatToStr)

DataStrToFloat

(change DecimalSeparator to '.' then call StrToFloat)

UIStrToFloat

(change DecimalSeparator to UIDecimalSeparator then call StrToFloat)


Now you code can use FloatToDataStr / DataStrToFloat for file I/O, and
FloatToUIStr / UIStrToFloat for UI purposes.

Similar wrappers for DateToStr / StrToDate can be made.

-Gary



Message is in Reply To:
  Re: Delphi and decimal signs.
 
"Tore Eriksson" <tore.eriksson@mbox3...wipnet.se> skrev i meddelandet news:3B8154F2.D99058...pnet.se... (...) national settings? The problem is that numerical constants in the code must always adhere to the English notation (decimal point). (...) (23 years ago, 20-Aug-01, to lugnet.cad.dev)

7 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR