comp.lang.ada
 help / color / mirror / Atom feed
From: Marin David Condic <condicma@bogon.pwfl.com>
Subject: Re: Integer to String Conversion?
Date: 1998/12/16
Date: 1998-12-16T00:00:00+00:00	[thread overview]
Message-ID: <3677C46A.FFC450C0@pwfl.com> (raw)
In-Reply-To: 756ue7$7o3$1@nnrp1.dejanews.com

bwefler@my-dejanews.com wrote:
> 
> Does anyone know an Ada-83 compatible method to convert an integer to a
> string, so that the string may be concatenated with another string, and the
> resulting string passed as a parameter to a function call?  (Note: I am not
> talking about using Text_IO or Integer_IO in this case;  I simply want the
> result to be a string.  Another function will take care of the string.)
> 
The usual way is with the 'Image attribute, but you may need to exercise
a little caution, given that it is defined to return either a leading
minus sign or a leading space and in either case, whatever you pass it
to has to deal with that appropriately.

See the Ada83 LRM, 3.5.5(10)

For the type "Integer" and an object "X" of type "Integer" you would
have a function like this:

Integer'Image (X)

This will return the character string.

There is also, within Text_IO.Integer_IO a procedure "Put" which can put
an integer into a string, rather than to a file. This is typically more
work than the 'Image solution.

MDC
-- 
Marin David Condic
Real Time & Embedded Systems, Propulsion Systems Analysis
United Technologies, Pratt & Whitney, Large Military Engines
M/S 731-95, P.O.B. 109600, West Palm Beach, FL, 33410-9600
Ph: 561.796.8997         Fx: 561.796.4669
***To reply, remove "bogon" from the domain name.***

"Eagles may soar, but a weasle never gets sucked up into a jet engine."

        --  Author Unknown




      parent reply	other threads:[~1998-12-16  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-16  0:00 Integer to String Conversion? bwefler
1998-12-16  0:00 ` Matthew Heaney
1998-12-18  0:00   ` dewarr
1998-12-16  0:00 ` dennison
1998-12-16  0:00 ` Tom Moran
1998-12-16  0:00 ` Marin David Condic [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox