var Montant: String; Flt: Real // (ou tout autre type réel) Flt := 3.1451; Montant := Format('%.2f', [Flt]);
uses Math; {$R *.DFM} function Precision(Value : real; Decimales : integer) : real; var n : Extended; begin n := round(intPower(10,Decimales)); Result := Round(Value * n) / n; end;
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionvar s : string; begin Str(ExtendedValue:0:2,s); result:=s; end;
Str(ExtendedValue:0:2,s); if Pos('.',s)<>0 then s[Pos('.',s)]:=','; result:=s;