You need 3 after the decimal point try
format('%.3d',[TNMBR])

        -----Original Message-----
        From:   John Bird [SMTP:[EMAIL PROTECTED]]
        Sent:   Monday, 27 January 2003 15:19
        To:     Multiple recipients of list delphi
        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/

DISCLAIMER:  This electronic message together with any attachments is 
confidential.  If you are not the intended recipient, do not copy, disclose or 
use the contents in any way.  Please also advise us by return e-mail that you 
have received the message and then please destroy.  Carter Holt Harvey is not 
responsible for any changes made to this message and / or any attachments after 
sending by Carter Holt Harvey.  We use virus scanning software but exclude all 
liability for viruses or anything similar in this email or any attachment.
---------------------------------------------------------------------------
    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