From: "Matthew Heaney" <matthew_heaney@acm.org>
Subject: Re: Converting string to float and integer
Date: 2000/01/09
Date: 2000-01-09T00:00:00+00:00 [thread overview]
Message-ID: <387815e9_4@news1.prserv.net> (raw)
In-Reply-To: 3vSd4.35559$E36.436449@news2-hme0
In article <3vSd4.35559$E36.436449@news2-hme0> , "Daniel Platt"
<dan-news@ofdan.co.uk> wrote:
> I am tring to convert a string into a float and/or integer.
Every scalar type comes with predefined attributes to convert from
string to that type, and from that type to a string.
Convert_String_To_Int:
declare
Image : constant String := "42";
Value : constant Integer := Integer'Value (Image);
begin
null;
end Convert_String_To_Int;
Convert_Int_To_String:
declare
Value : constant Integer := 42;
Image : constant String := Integer'Image (Value);
begin
null;
end Convert_Int_To_String;
To convert between Float and String, use Float'Image and Float'Value.
To convert between any scalar type T and String, use T'Image and
T'Value.
--
Help keep evolution in the science classroom and religion out: become a
member of the National Center for Science Education.
<http://www.natcenscied.org/>
next prev parent reply other threads:[~2000-01-09 0:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-01-09 0:00 Converting string to float and integer Daniel Platt
2000-01-09 0:00 ` Matthew Heaney [this message]
2000-01-09 0:00 ` Richard D Riehle
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox