Lazarus: Change Decimal Separator (Dot and Comma)
Question by Guest | Last update on 2021-07-07 | Created on 2014-12-12
Sometimes, I am writing floating-point numbers and numerical values having decimal places with a point, sometimes with a comma. So, for example 1.23 or 1,23.
However, Lazarus only seems to understand the separation with a dot, it is not accepting comma values as input.
How can I teach Lazarus to be able to work with the comma as decimal separator as well?
Related Topics
Delphi/Lazarus: 3 Ways to round a Number to X Decimal Places
Tutorial | 7 Comments
Delphi/Lazarus: Only allow Numbers in TEdit
Tip | 0 Comments
Lazarus: Input of binary, hexadecimal and integer numbers
Article | 0 Comments
Delphi/Lazarus: Round Number to the next 10, 100 or 1000
Question | 1 Answer
Delphi/Lazarus: Show Byte Array as String of HEX Values
Tip | 0 Comments
Delphi/Lazarus: Round Decimal Numbers up, down and normally
Tip | 0 Comments
VirtualBox: Change Date and Time
Tutorial | 10 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
In Lazarus, there is the global variable or setting DefaultFormatSettings > DecimalSeparator. This is determining which character (char) is used as decimal separator.
It is possible to change the settings like that:
Depending on which number input you are expecting, you can set the decimal separator with DecimalSeparator to a point, a comma or any other random character.
PS: Using DefaultFormatSettings.ThousandSeparator instead, you can change the character that is used as thousand separator between 3 numbers for better readability, if you want to change this, too.
Last update on 2021-07-07 | Created on 2014-12-14