From: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Subject: Re: Convert ASCII numerals to Integer numbers
Date: 6 Aug 2001 16:09:11 GMT
Date: 2001-08-06T16:09:11+00:00 [thread overview]
Message-ID: <9kmff7$asb$1@drcomp.erfurt.thur.de> (raw)
In-Reply-To: h1uqmto63djje1sgg1futccs5adbsvkokf@4ax.com
Stewart <s_aitken@lineone.net> wrote:
> I am creating a menu and I am grabbing the terminal input using
> get_line, but on this particular command the last 1 .. 3 characters
> can be numerals in the range of 1 .. 999.
> I am considering character'pos but how can I manipulate to an integer?
Generally, you can use the string index:
procedure karl is
input : string(1..6);
i,j : integer;
begin
get_line(input,j);
i := Integer'Value(input(j-2..j) );
put(i);
end karl;
Of course, you should replace this by dynamic handling, i.e. unbounded
strings combined with input'last-2 .. input'last.
--
mail: adi@thur.de http://adi.thur.de PGP: v2-key via keyserver
Microsoft - Is that a kind of toilet paper?
prev parent reply other threads:[~2001-08-06 16:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-05 16:58 Convert ASCII numerals to Integer numbers Stewart
2001-08-05 17:34 ` Jacob Sparre Andersen
2001-08-05 17:57 ` Stewart
2001-08-05 18:13 ` martin.m.dowie
2001-08-05 18:15 ` tmoran
2001-08-06 16:09 ` Adrian Knoth [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