| | Delphi and decimal signs.
|
|
Look at following Delphi code: s: string; f: double; i: Integer; begin f := 3.14; // correct f := 3,14; // error (of course...) f := StrToFloat('3.14'); // error f := StrToFloat('3,14'); // correct s := FloatToStr(3.14); // s is assigned '3,14' Is (...) (23 years ago, 20-Aug-01, to lugnet.cad.dev)
|
|
| | Re: Delphi and decimal signs.
|
|
(...) national settings? f := 3.14; // correct f := 3,14; // error f := StrToFloat('3.14'); // correct f := StrToFloat('3,14'); // error s := FloatToStr(3.14); // s is assigned '3.14' -Gary (23 years ago, 20-Aug-01, to lugnet.cad.dev)
|
|
| | Re: Delphi and decimal signs.
|
|
(...) With careful manipulation of the DecimalSeparator and ThousandSeparator global variables, one could write a Delphi app that reads/writes periods (full stop symbols) from/to DAT files, but displays the locale-specific symbols to the user and (...) (23 years ago, 20-Aug-01, to lugnet.cad.dev)
|
|
| | Re: Delphi and decimal signs.
|
|
Aah, that explains a lot. Thank you for your quick reply! /Tore (...) (23 years ago, 20-Aug-01, to lugnet.cad.dev)
|
|
| | 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)
|
|
| | Re: Delphi and decimal signs.
|
|
Careful manipulation? All I need to do is add the line DecimalSeparator := '.'; to FormCreate and all my problems are gone! Gary, you are a hero! I'll check out ThousandSeparator later. Thanks again! /Tore (...) (23 years ago, 20-Aug-01, to lugnet.cad.dev)
|
|
| | Re: Delphi and decimal signs.
|
|
(...) screen (...) to (...) your (...) 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 (...) (23 years ago, 20-Aug-01, to lugnet.cad.dev)
|