Article View: comp.lang.pascal.misc
Article #81Re: Output formatting Question
From: Dr John Stockton
Date: Fri, 14 Dec 2001 20:42
Date: Fri, 14 Dec 2001 20:42
27 lines
2590 bytes
2590 bytes
JRS: In article <3C1A3235.5B88630E@marine.usf.edu>, seen in
news:comp.lang.pascal.borland, Jeff Donovan <jeff@marine.usf.edu> wrote
at Fri, 14 Dec 2001 12:09:09 :-
> I am trying to update some code left by a previous programmer, and
>not knowing Pascal very well I am stuck. Can someone please tell
>me how to add leading zeros to a when outputting an integer. I am trying
>to create a hh:mm:ss time string form integer hours, minutes, and
>seconds variables.
Please read Borland's newsgroup guidelines, via mFAQ IIRC. When posting
to c.l.p.misc, you need to indicate dialect; cross-posting in c.l.p.* is
rarely needed.
I use in TP & BP & Delphi something like
function CC(J : word) : string { CC:=00..99 } ; var St : string [2] ;
begin Str(J:2, St) ; if St[1]=#32 then St[1] := '0' ; CC := St end ;
If there is any chance that J may be outside 0-99, use a longer string
and/or a signed parameter.
--
� John Stockton, Surrey, UK. jrs@merlyn.demon.co.uk Turnpike v4.00 MIME. �
<URL: http://www.merlyn.demon.co.uk/> TP/BP/Delphi/&c., FAQqy topics & links;
<URL: http://www.merlyn.demon.co.uk/clpb-faq.txt> Pedt Scragg: c.l.p.b. mFAQ;
<URL: ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip> Timo Salmi's Turbo Pascal FAQ.
Technical Details
Message-ID:
<c$LLjwDeQmG8EwYS@merlyn.demon.co.uk>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!dispose.news.demon.net!news.demon.co.uk!demon!merlyn.demon.co.uk!spamReferences:
<3C1A3235.5B88630E@marine.usf.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10261c,4d112d056daac5d7 X-Google-Attributes: gid10261c,public X-Google-Thread: 111659,4d112d056daac5d7 X-Google-Attributes: gid111659,public X-Google-Thread: 108ebd,4d112d056daac5d7 X-Google-Attributes: gid108ebd,public X-Google-ArrivalTime: 2001-12-14 15:40:02 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!dispose.news.demon.net!news.demon.co.uk!demon!merlyn.demon.co.uk!spam From: Dr John Stockton <spam@merlyn.demon.co.uk> Newsgroups: comp.lang.pascal.misc,borland.public.turbopascal,comp.lang.pascal.borland Subject: Re: Output formatting Question Date: Fri, 14 Dec 2001 20:42:06 +0000 Organization: Home, 'Surrey', UK Message-ID: <c$LLjwDeQmG8EwYS@merlyn.demon.co.uk> References: <3C1A3235.5B88630E@marine.usf.edu> Reply-To: Dr John Stockton <reply@merlyn.demon.co.uk> NNTP-Posting-Host: merlyn.demon.co.uk X-NNTP-Posting-Host: merlyn.demon.co.uk:158.152.233.145 X-Trace: news.demon.co.uk 1008373187 nnrp-02:29082 NO-IDENT merlyn.demon.co.uk:158.152.233.145 X-Complaints-To: abuse@demon.net MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain;charset=iso-8859-1 X-Newsreader: Turnpike (32) Version 4.00 <FaPHOaas0ellLCXbR0oIxSiVaE> Lines: 27