comp.lang.ada
 help / color / mirror / Atom feed
From: maa@liacc.up.pt (Mário Amado Alves)
Subject: Re: how to parse words from a string
Date: 18 Nov 2002 03:00:58 -0800
Date: 2002-11-18T11:00:58+00:00	[thread overview]
Message-ID: <4a4de33a.0211180300.1eeacc85@posting.google.com> (raw)
In-Reply-To: 3DD806CF.9090204@acm.org

> >   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;
 
> ... doesn't read from an arbitrary file

Trivial adaptation, left as an exercise. Hints: see A.10.1 (15) and (41).

> nor handle words separated by horizontal tabs.

Of course it does. See A.3.2 (23).

--MAA



  reply	other threads:[~2002-11-18 11:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-12 19:33 how to parse words from a string Sarah Thomas
2002-11-12 20:15 ` Stephen Leake
2002-11-12 20:16 ` Simon Wright
2002-11-13 10:17 ` Caffeine Junky
2002-11-14  2:10   ` Chad R. Meiners
2002-11-14  2:40     ` Caffeine Junky
2002-11-14  3:09       ` sk
2002-11-14  5:31         ` Dennis Lee Bieber
2002-11-14 13:40           ` Sarah Thomas
2002-11-14 14:56             ` David C. Hoos
2002-11-14 18:45             ` Jeffrey Carter
2002-11-17  8:40               ` Mário Amado Alves
2002-11-17 21:14                 ` Jeffrey Carter
2002-11-18 11:00                   ` Mário Amado Alves [this message]
2002-11-18 19:23                     ` Jeffrey Carter
replies disabled

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