From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,37c1f61bd0b7914 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!b5g2000pri.googlegroups.com!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Converting Type Characters to type string Date: Mon, 31 Mar 2008 07:11:07 -0700 (PDT) Organization: http://groups.google.com Message-ID: <1af1dbf5-bc4e-4edd-ae53-649896b2166c@b5g2000pri.googlegroups.com> References: <8f5967a7-17ab-4eda-80fc-5cb58ae011f5@s50g2000hsb.googlegroups.com> <2d291584-9cb9-4a3f-8626-7b7066e60566@59g2000hsb.googlegroups.com> NNTP-Posting-Host: 153.98.68.197 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1206972667 3586 127.0.0.1 (31 Mar 2008 14:11:07 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 31 Mar 2008 14:11:07 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: b5g2000pri.googlegroups.com; posting-host=153.98.68.197; posting-account=pcLQNgkAAAD9TrXkhkIgiY6-MDtJjIlC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.3) Gecko/20040924,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20670 Date: 2008-03-31T07:11:07-07:00 List-Id: 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.