<p>Am 12.12.2012 13:17 schrieb "Lukasz Sokol" <<a href="mailto:el.es.cr@gmail.com">el.es.cr@gmail.com</a>>:<br>
><br>
> On 12/12/2012 11:23, Richard Mace wrote:<br>
> > Hi All, Got a simple question that has stumped me, which tends to<br>
> > happen if I don't do development for a couple of months.<br>
> ><br>
> > How's the best way of converting an integer number "208" (that is<br>
> > pence) into a string value that is in pounds (2.08)<br>
> ><br>
> > Thanks as always in advance.<br>
> ><br>
> > Richard<br>
> ><br>
> ><br>
> -ENOTENOUGHINFO (do you assume 2 decimal places always?)<br>
><br>
> but simplest variable precision would probably be<br>
><br>
> function PenceToString(ANumber: integer; APrecision : integer = 2):string<br>
> begin<br>
> Result := Format('%.'+IntToStr(APrecision)'f',[ANumber div (10**APrecision)]);<br>
> end;</p>
<p>The ** operator for floating point (and integers) is implemented in unit Math.</p>
<p>Regards,<br>
Sven</p>