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: a07f3367d7,7776df5b2a2fcc30 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!weretis.net!feeder4.news.weretis.net!news.tornevall.net!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: Beginner Question Date: Wed, 20 Oct 2010 15:43:28 -0700 Organization: TornevallNET - http://news.tornevall.net Message-ID: References: <90ceb514-83aa-44c2-b253-218956d8426d@d17g2000yqm.googlegroups.com> NNTP-Posting-Host: c7c5eb19750a5094b55fbcef2e38c69f Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: c9ae6ceab96903c70d2cffe27ab7b862 X-Complaints-To: abuse@tornevall.net User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 X-Complaints-Language: Spoken language is english or swedish - NOT ITALIAN, FRENCH, GERMAN OR ANY OTHER LANGUAGE! In-Reply-To: <90ceb514-83aa-44c2-b253-218956d8426d@d17g2000yqm.googlegroups.com> X-UserIDNumber: 1738 X-Validate-Post: http://news.tornevall.net/validate.php?trace=c9ae6ceab96903c70d2cffe27ab7b862 X-Complaints-Italiano: Non abbiamo padronanza della lingua italiana - se mandate una email scrivete solo in Inglese, grazie X-Posting-User: 0243687135df8c4b260dd4a9a93c79bd Xref: g2news2.google.com comp.lang.ada:15607 Date: 2010-10-20T15:43:28-07:00 List-Id: On 10/20/2010 02:41 PM, SpoonThief wrote: > So, I have a question that may seem painfully obvious, but how does > one go about parsing a Float from a string that has other data in it > too? I'm getting a line from the keyboard that has a float and a > custom type in it, and I need to separate the two values. I'm using a > call to Get_Line to get the entire line the user entered as a string, > and when I try to call Float'Value (In_String (1 .. Last)), I get a > constraint error. Is there any way to parse a float and a custom > subtype (Excellent, Good, Fair, Poor) from one string, or am I going > about this the entirely wrong way? Any help would be much appreciated, > and if clarification is needed because I wasn't clear, just ask. Thank > you in advance! You might want to look at Ada.Text_IO.Float_IO, specifically procedure Get(From : in String; Item : out Num; Last : out Positive); (ARM A.10.1; http://www.adaic.org/standards/05rm/html/RM-A-10-1.html). -- Jeff Carter "You empty-headed animal-food-trough wiper." Monty Python & the Holy Grail 04