DelphiBasics
DecimalSeparator
Variable
The character used to display the decimal point SysUtils unit
  var DecimalSeparator : char;
Description
The DecimalSeparator variable is used in currency and floating point display functions.
 
DecimalSeparator value is '.' by default, depending on the Windows locale.
Notes
DecimalSeparator = LOCALE_SDECIMAL by default.
Related commands
CurrencyDecimals Defines decimal digit count in the Format function
CurrencyFormat Defines currency string placement in curr display functions
CurrencyString The currency string used in currency display functions
CurrToStrF Convert a currency value to a string with formatting
FloatToStr Convert a floating point value to a string
Format Rich formatting of numbers and text into a string
NegCurrFormat Defines negative amount formatting in currency displays
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




 
Example code : Changing the decimal point character
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  SysUtils,   // Unit containing the DecimalSeparator command
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

var
  amount : Currency;
begin
  amount := 12.34;    // 12 pounds 34 pence

  // Display with the default decimal point character
  ShowMessage('Amount = '+FloatToStrF(amount, ffCurrency, 10, 2));

  // Display with a new decimal point character
  DecimalSeparator := '|';
  ShowMessage('Amount = '+FloatToStrF(amount, ffCurrency, 10, 2));
end;
 
end.
Hide full unit code
   Amount = ?12.34
   Amount = ?12|34
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page