comp.lang.ada
 help / color / mirror / Atom feed
* armin.schmidle@chnet.mail.abb.com
@ 1998-09-05  0:00 Armin
  1998-09-05  0:00 ` armin.schmidle@chnet.mail.abb.com Matthew Heaney
  0 siblings, 1 reply; 2+ messages in thread
From: Armin @ 1998-09-05  0:00 UTC (permalink / raw)


Question:
---------
can anyone tell me how i can get mystring := "4.56" to become myfloat :=
4.56
or mystring := "123" to become myinteger := 123

Answer:
--------
it easy if you know how

that's the manual

27 procedure Get(From : in String; Item : out Num; Last : out Positive);

28 Reads a real value from the beginning of the given string, following
the
same rule as the Get procedure that reads a real value from a file, but
treating the end of the string as a file terminator. Returns, in the
parameter Item, the value of type Num that corresponds to the sequence
input. Returns in Last the index value such that From(Last) is the last
character read.
 here is an example
s : string (1..10) := "1.20      ";
f : float
l : integer;

 begin
Get(From => s;,
Item => f,
 Last => l);







^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: armin.schmidle@chnet.mail.abb.com
  1998-09-05  0:00 armin.schmidle@chnet.mail.abb.com Armin
@ 1998-09-05  0:00 ` Matthew Heaney
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Heaney @ 1998-09-05  0:00 UTC (permalink / raw)


Armin <ArminSchmidle@swol.de> writes:

> can anyone tell me how i can get mystring := "4.56" to become myfloat :=
> 4.56

   Myfloat : constant Float := Float'Value (MyString);

> or mystring := "123" to become myinteger := 123

  MyInteger : constant Integer := Integer'Value (MyString);





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-09-05  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-09-05  0:00 armin.schmidle@chnet.mail.abb.com Armin
1998-09-05  0:00 ` armin.schmidle@chnet.mail.abb.com Matthew Heaney

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