unit TestKDoubleForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, kEditPnl, StdCtrls, EditDouble, EditDoubleIni;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Button1: TButton;
    EditDoubleIni1: TEditDoubleIni;
    EditFmt: TEditPanel;
    EditFmtEdit: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    procedure Add(msg:string; s: string='');
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation
uses kdouble;
{$R *.dfm}

procedure TForm1.Add(msg,s:string);
var d : double;
begin
  if ( s = '' ) then s := msg;
  d := StrToAnyDouble(s);
  Memo1.Lines.Add(Format('%-30s:  %22s => %22s',[msg,'"'+s+'"',DoubleToIniStr(d)]));
end;

procedure TForm1.FormCreate(Sender: TObject);
var d : double;
begin
  d := 123456789.12345;
  Add('DoubleToIniStr(d)',DoubleToIniStr(d));
  Add('DoubleToStr(d)',DoubleToStr(d));
  Add('DoubleToIniStr(d,20,3)',DoubleToIniStr(d,20,3));
  Add('DoubleToStr(d,20,3)',DoubleToStr(d,20,3));
  Add('DoubleToFStr(d,20,3)',DoubleToFStr(d,20,3));
  Add('DoubleToFStr(d,20,3)+mk',DoubleToFStr(d,20,3)+'mk');
  Add('-123.23e8 mk');
  Add('-123.23E-8 mk');
  Add('-123.23E-8E mk');
  Add('123e');
  Add('123 e');
  Add('123 €');
  Add('123e2e');
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Add(EditFmt.AsString,DoubleToStr(EditDoubleIni1.Value,EditFmt.AsString));
end;

end.
