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-Language: ENGLISH,ASCII X-Google-Thread: 103376,b34ecb04700058dd X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-17 13:14:00 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn13feed!wn11feed!worldnet.att.net!207.217.77.102!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3DD806CF.9090204@acm.org> From: Jeffrey Carter User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: how to parse words from a string References: <3DD3EF12.3010009@acm.org> <4a4de33a.0211170040.1b8de118@posting.google.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Date: Sun, 17 Nov 2002 21:14:00 GMT NNTP-Posting-Host: 63.184.0.93 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 1037567640 63.184.0.93 (Sun, 17 Nov 2002 13:14:00 PST) NNTP-Posting-Date: Sun, 17 Nov 2002 13:14:00 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:31013 Date: 2002-11-17T21:14:00+00:00 List-Id: M�rio Amado Alves wrote: >>Another approach is to parse the words as you read the file; for an >>example, see PragmARC.Word_Input from the PragmAda Reusable Components >> >>http://home.earthlink.net/~jrcarter010/pragmarc.htm > > > Or simply write: > > C : Character > Word : Unbounded_String; > begin > loop > Get_Immediate (C); > if Is_Graphic (C) and C /= ' ' then > Append (Word, C); > else > Process (Word); > Word := Null_Unbounded_String; > end if; > end loop; > exception > when End_Error => > if Word /= Null_Unbounded_String then Process (Word); end if; > > as was recently posted on thread "parse word from a string" ;-) which doesn't read from an arbitrary file nor handle words separated by horizontal tabs. -- Jeff Carter "English bed-wetting types." Monty Python & the Holy Grail