On 12/12/2012 15:21, Howard Page-Clark wrote: >> > > How's the best way of converting an integer number "208" (that is >> > > pence) into a string value that is in pounds (2.08) > > Here's another variant that provides an optional $, £ or € > > uses math; > function PenceToString(pennies: integer; precision: integer=2; > currency: string=''): string; > begin > Result:= Format(Format(currency+'%%.%df',[precision]), > [pennies/(10**precision)]); > end; >
Being purist, maybe Format('%s%%.%df',[currency, precision],[pennies/(10**precision)]); No ? :) Lukasz -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus