From: "Martin Dowie" <martin.dowie@no.spam.btopenworld.com>
Subject: Re: Base 12 Integer IO
Date: Mon, 3 Feb 2003 16:42:44 +0000 (UTC)
Date: 2003-02-03T16:42:44+00:00 [thread overview]
Message-ID: <b1m664$a0l$1@knossos.btinternet.com> (raw)
In-Reply-To: mailman.12.1044286941.3911.comp.lang.ada@ada.eu.org
> 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. :-)
next prev parent reply other threads:[~2003-02-03 16:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.12.1044286941.3911.comp.lang.ada@ada.eu.org>
2003-02-03 16:02 ` Base 12 Integer IO Mark Biggar
2003-02-03 16:42 ` Martin Dowie [this message]
2003-02-03 18:56 ` Georg Bauhaus
2003-02-04 3:37 ` Steve
2003-02-04 10:58 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox