I think you're looking for the FormatFloat function.

ATNMBR = FormatFloat("000", TNMBR);

----- Original Message -----
From: "John Bird" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Monday, January 27, 2003 3:19 PM
Subject: Re: [DUG]: Dollar amounts in int fields


> I have a real basic Delphi 5 question, forgive me for asking such a silly
> one but
> I cannot sort it out from the help
>
> ATNMBR:string;
> TNMBR:integer;
>
> I am trying to get ATNMBR (string) to contain an integer using 3
> characters, e.g.
> 1       -> 001
> 5       -> 005
> 10      -> 010
> 100     ->100
>
>            ATNMBR:=format('%3d',[TNMBR]);                doesn't seem to
> work, produces '  1'
>            ATNMBR:='001';                                this works,
> unfortunately only caters
>                                                          for the case when
> TNMBR = 1
>
> The format help talks of a prec (precision) qualifier, but doesn't give an
> example of how to use it
>
>
>
>
>
> John Bird
> Beyond Data Systems
> [EMAIL PROTECTED]
> Ph 64-3-3654656 or 027 436-7702
> Fax 03-3793340
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to