comp.lang.ada
 help / color / mirror / Atom feed
From: JPWoodruff@gmail.com
Subject: Re: Converting Integer / Float to String
Date: Sat, 19 Jul 2008 17:28:07 -0700 (PDT)
Date: 2008-07-19T17:28:07-07:00	[thread overview]
Message-ID: <111f09f0-b596-45d6-8321-ebe8a0dd67c8@z16g2000prn.googlegroups.com> (raw)
In-Reply-To: newscache$sc454k$rp5$1@pleione.3soft.de

On Jul 17, 1:49 am, "Alexander Camek" <Alexander.Ca...@Elektrobit.com>
wrote:
> Hi List,
>
> is there another way to convert a given String to an Integer or Float type?
>

Perhaps you could use some part of the numeric IO packages I
constructed some years back:

http://www.dmitry-kazakov.de/ada/Numeric-Name-IO.htm

(Dmitry has kindly hosted the distribution of my contribution)

The packages Numeric_IO and Name_IO, together with their children and
support, assist a program to read a user’s input.  The packages are
intended to support numerical computation by providing “Get” and “Put”
procedures for floating numbers and for vectors and matrices of
floating numbers.

The procedures ease an end-user’s burden in preparing inputs for
computational programs.  The rules for input of floating numbers are
relaxed so that program inputs need not conform to the strict Ada
syntax for floating numbers. Facilities allow input either from files
or interactively. Consistent policies throughout all the services
allow programs to address input errors, to prompt the end-user
interactively or to specify optional default values.

Name-directed input can be used to read a file of input data, even
including physical units as defined by Dmitry's Measures_Edit.

Here are example lines from an input file that could be read by your
program that employs these packages:

 Vect := 1.414, 1.732, 2.0 ;
 P  := 14.9 psi ;   -- one standard atmosphere

--
John



      parent reply	other threads:[~2008-07-20  0:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-17  7:49 Converting Integer / Float to String Alexander Camek
2008-07-17  8:05 ` anon
2008-07-17  8:15 ` Dmitry A. Kazakov
2008-07-17  8:32   ` Alexander Camek
2008-07-17  9:24     ` Dmitry A. Kazakov
2008-07-20  0:28 ` JPWoodruff [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