[Lazarus] Converting pence into pounds and then to string
Marco van de Voort
marcov at stack.nl
Wed Dec 12 20:28:23 CET 2012
On Wed, Dec 12, 2012 at 11:23:46AM +0000, Richard Mace wrote:
> Got a simple question that has stumped me, which tends to happen if I don't
> do development for a couple of months.
>
> How's the best way of converting an integer number "208" (that is pence)
> into a string value that is in pounds (2.08)
Logically, to format currency one uses the standard library function
formatcurr:
http://www.freepascal.org/docs-html/rtl/sysutils/formatcurr.html
uses sysutils;
var v : currency;
begin
v:=208 /100;
writeln(formatcurr('#.##',v));
end.
More information about the Lazarus
mailing list