comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: Converting Type Characters to type string
Date: Mon, 31 Mar 2008 07:11:07 -0700 (PDT)
Date: 2008-03-31T07:11:07-07:00	[thread overview]
Message-ID: <1af1dbf5-bc4e-4edd-ae53-649896b2166c@b5g2000pri.googlegroups.com> (raw)
In-Reply-To: e29aa5d8-0de6-4248-b22a-e5dc2094ff00@n58g2000hsf.googlegroups.com

jedivaughn wrote:
> The only problem I'm having is that I don't want to have to add a
> space or another character to the end of my string of numbers. As long
> as I set str : strin (1..999) := (others -> ' '); I can get all the
> characters I want but they have to be followed by something other then
> for a digit. Is there a way to get an input of a length unknown
> without having to take an extra character? 0ne user suggested the
> look_ahead  procedure if that would help solve this how would I use
> that?

Generally there are two ways of doing text input: fixed-width and
variable-width. In fixed-width form, the user must type exactly the
number of digits *you* want (no more, no less) but there is no need
for an extra character. This is really only useful when reading from a
file instead of the keyboard. In variable-width form, the user types
as many characters as *they* want, but they also have to insert a
terminating character. Usually, that character is Line Feed (produced
with the ENTER key). If that's what you want, you may want to call
Ada.Text_IO.Get_Line then traverse the resulting string looking for
digits.

See also http://www.it.bton.ac.uk/staff/je/adacraft/ch02.htm#2.6

--
Ludovic Brenta.



  reply	other threads:[~2008-03-31 14:11 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-30 20:04 Converting Type Characters to type string jedivaughn
2008-03-30 20:19 ` Pascal Obry
2008-03-30 21:08   ` jedivaughn
2008-03-30 21:28     ` jimmaureenrogers
2008-03-30 21:38     ` Ludovic Brenta
2008-03-30 21:48   ` Georg Bauhaus
2008-03-30 23:52     ` jedivaughn
2008-03-31  3:04       ` george.priv
2008-03-31  4:00         ` tmoran
2008-03-31  8:54           ` Ludovic Brenta
2008-03-31  9:59             ` Dmitry A. Kazakov
2008-03-31 10:59               ` Jean-Pierre Rosen
2008-03-31 13:50                 ` jedivaughn
2008-03-31 14:11                   ` Ludovic Brenta [this message]
2008-03-31 14:21                   ` Dmitry A. Kazakov
2008-03-31 14:44                     ` jedivaughn
2008-03-31 15:41                       ` Adam Beneschan
2008-03-31 20:26                         ` Maciej Sobczak
2008-03-31 22:06                           ` Georg Bauhaus
2008-03-31 22:33                           ` Adam Beneschan
2008-04-01  1:00                             ` jedivaughn
2008-04-01  5:34                               ` Simon Wright
2008-04-01 11:22                                 ` jedivaughn
2008-04-01 12:00                                   ` jimmaureenrogers
2008-04-01 13:22                                     ` jedivaughn
2008-04-01 17:03                                       ` Adam Beneschan
2008-04-01 21:11                                   ` Simon Wright
2008-04-01 22:22                                     ` jedivaughn
2008-04-03  5:54                                   ` tmoran
2008-04-03 14:38                                     ` Adam Beneschan
2008-04-01 16:58                               ` Adam Beneschan
2008-03-31 15:45                       ` Dmitry A. Kazakov
replies disabled

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