comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@ni.net (Matthew Heaney)
Subject: Re: I'm Stumped ...
Date: 1997/04/27
Date: 1997-04-27T00:00:00+00:00	[thread overview]
Message-ID: <mheaney-ya023680002704971326460001@news.ni.net> (raw)
In-Reply-To: 33638FBE.715C@usa.net


In article <33638FBE.715C@usa.net>, Ben Carter <b_c@usa.net> wrote:

>Could anyone point me in the direction of where
>I could find examples of code or at least explain
>a method to convert a string into an integer?
>
>Is it possible to take a string with the value :
>   '123'
>and turn it into the integer 123?

The Value attribute is the opposite of the Image attribute:

declare
   The_Value : constant Integer := Integer'Value ("123");
begin

You can also instantiate package Ada.Text_IO.Integer_IO, which exports a
subprogram Get to read a value from a string.

declare
   The_Value : Integer;
   Last : Positive;
begin
   Ada.Integer_Text_IO.Get (From => "123", Item => The_Value, Last => Last);

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271




  parent reply	other threads:[~1997-04-27  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-28  0:00 I'm Stumped Ben Carter
1997-04-27  0:00 ` Robert Dewar
1997-04-27  0:00 ` Matthew Heaney [this message]
1997-04-28  0:00 ` Stephen Leake
1997-04-30  0:00 ` Gautier
1997-04-30  0:00   ` Mats Weber
replies disabled

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