Re: Format function in Delphi

Posted by webmaster Guido on September 01, 2005

In Reply to: Re: Format function in Delphi posted by robert on August 30, 2005

: is it possible write floats right aligned?

By default, the Delphi function Format returns strings that are right aligned. Example:
R := 120.7;
S := Format('%10.2f', [R]);

For left alignment you have to add a - character after the %. Example:
S := Format('%-10.2f', [R]);

...as explained in my previous message ;)

Related Articles and Replies