comp.lang.ada
 help / color / mirror / Atom feed
* Re: Conversion of numbers to strings & vice-versa
       [not found] <937pip$9qq$1@news.vsnl.net.in>
@ 2001-01-16 10:17 ` John English
  0 siblings, 0 replies; only message in thread
From: John English @ 2001-01-16 10:17 UTC (permalink / raw)


> Are there any functions in the Ada library that convert integers
> to strings and vice versa -- something like the C atoi (), atof ()
> etc.

There are attributes for this stuff: X'Image(Y) converts Y (of type X)
to a string, and X'Value(Y) converts Y (a string) to type X.

Some examples:
  Integer'Image(123) = " 123"
  Float'Value("123_456.789") = 1.23456789E+5
  Boolean'Value("true") = True
  Boolean'Image(False) = "FALSE"

-----------------------------------------------------------------
 John English              | mailto:je@brighton.ac.uk
 Senior Lecturer           | http://www.it.bton.ac.uk/staff/je
 Dept. of Computing        | ** NON-PROFIT CD FOR CS STUDENTS **
 University of Brighton    |    -- see http://burks.bton.ac.uk
-----------------------------------------------------------------



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-01-16 10:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <937pip$9qq$1@news.vsnl.net.in>
2001-01-16 10:17 ` Conversion of numbers to strings & vice-versa John English

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