From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,74e13f9928bee620 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-03 08:45:07 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.vmunix.org!newsfeed.stueberl.de!newsr1.ipcore.viaginterkom.de!btnet-peer1!btnet-feed5!btnet!news.btopenworld.com!not-for-mail From: "Martin Dowie" Newsgroups: comp.lang.ada Subject: Re: Base 12 Integer IO Date: Mon, 3 Feb 2003 16:42:44 +0000 (UTC) Organization: BT Openworld Message-ID: References: NNTP-Posting-Host: host81-132-26-154.in-addr.btopenworld.com X-Trace: knossos.btinternet.com 1044290564 10261 81.132.26.154 (3 Feb 2003 16:42:44 GMT) X-Complaints-To: news-complaints@lists.btinternet.com NNTP-Posting-Date: Mon, 3 Feb 2003 16:42:44 +0000 (UTC) X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MSMail-Priority: Normal X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Xref: archiver1.google.com comp.lang.ada:33732 Date: 2003-02-03T16:42:44+00:00 List-Id: > I would like to do base 12 Integer IO; > > while the following code fragment works > > for I in 0..1488 loop > > Put( I, Width => 3, Base => 12 ); [snip] > > How can I fix these things? Can I do Integer IO to a string, in order to reformat the string as I desire? You don't use Integer IO to reformat the the string but I would use Ada.Integer_Text_IO to convert to the 12#...# format string you have, then use the 'Index' routine in Ada.Strings.Fixed to find the first hash (and thus the first numerical value). Then string slice the 1, 2 or n base12 digits into a fixed sized, zero filled string (e.g. "000"). Then just call Ada.Text_IO.Put with this value. Shouldn't take more than about 6 statements. :-)