comp.lang.ada
 help / color / mirror / Atom feed
From: johnherro@aol.com (John Herro)
Subject: Re: String to Integer
Date: 1997/07/15
Date: 1997-07-15T00:00:00+00:00	[thread overview]
Message-ID: <19970715204901.QAA01858@ladder01.news.aol.com> (raw)
In-Reply-To: 5qglt7$cba$1@news.fsu.edu


hill@cs.fsu.edu (Charles Hill) writes:
> I have a string in which an integer is stored.
> I'd like to ... convert this to an actual integer.
> I'm wondering if there is a function built into
> one of the Ada packages to do this...

Not into an Ada *package*, but built into the language itself.
If S is the string and I is an Integer variable, you can write

I := Integer'Value(S);

The 'Value is called an attribute.  The 'Image attribute goes the
other way, so you could also write

S := Integer'Image(I);

'Image and 'Value work with many types, not just Integer, but
they always convert to and from strings.  For more information,
you can download the Ada Tutor program from the Web or FTP
sites below my signature.  I hope this helps.

- John Herro
Software Innovations Technology
http://members.aol.com/AdaTutor
ftp://members.aol.com/AdaTutor




  reply	other threads:[~1997-07-15  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-07-15  0:00 String to Integer Charles Hill
1997-07-15  0:00 ` John Herro [this message]
1997-07-16  0:00 ` Martin C. Carlisle
1997-07-16  0:00 ` Samuel Mize
1997-07-16  0:00 ` Robert Dewar
1997-07-17  0:00   ` Embedding Text Data in Source (Was Re: String to Integer) John M. Mills
1997-07-17  0:00     ` Samuel T. Harris
1997-07-19  0:00     ` Matthew Heaney
1997-07-17  0:00 ` String to Integer Michael F Brenner
     [not found]   ` <5qlrue$3ft@top.mitre.org>
1997-07-18  0:00     ` Samuel Mize
replies disabled

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