How about function Format(const Format: string; const Args: array of const): string; overload;
You'll find this in sysutils.pas. Jeremy -----Original Message----- From: advanced_delphi@yahoogroups.com on behalf of Bung Matrix Sent: Sun 8/10/2008 12:05 AM To: advanced_delphi@yahoogroups.com Subject: [advanced_delphi] FloatToStrF without zero padding Greeting, Did anyone know how to use FloatToStrF without zero padding? I need it because my code must avoid the usage of scientific notation, thus I used FloatToStrF with ffFixed format. But later I found out that the output of resulted string was padded with zeros. For temporarily, I use these code to remove all zero padding but still there must be some way which is more efficient... ---code begin--- function TDMod.FloatToStrNP(val : extended) : string ; var a : integer ; txt,retval : string ; begin txt := FloatToStrF(val,ffFixed,18,18) ; retval := '' ; for a:=Length(txt) downto 1 do begin if (txt[a]='0') and (retval <> '') then retval := txt[a]+retval else if txt[a]<>'0' then retval := txt[a]+retval ; end ; Result := retval ; end; ---code end--- --------------------- CoolKid K-Qha http://kha.web.id ---------------------
<<winmail.dat>>