comp.lang.ada
 help / color / mirror / Atom feed
From: "chris.danx" <spamoff.danx@ntlworld.com>
Subject: Re: An example was Re: Tokens
Date: Mon, 20 May 2002 00:30:29 +0100
Date: 2002-05-20T00:30:29+01:00	[thread overview]
Message-ID: <rAWF8.34892$Iv.4013048@news6-win.server.ntlworld.com> (raw)
In-Reply-To: dkWF8.34770$Iv.4001930@news6-win.server.ntlworld.com


"chris.danx" <spamoff.danx@ntlworld.com> wrote in message
news:dkWF8.34770$Iv.4001930@news6-win.server.ntlworld.com...

Hi,

Is there a cheap way to prevent the last "&" from being printed in the code
below?  I can think of several options but all of them require an additional
call to find_token or switching to a loop.  Is there another way that
doesn't have a repeated call to find token?

Since it's just an example there's no real harm done, it's just annoying
that's all!!!


Chris

>    procedure what_words (str    : in string;
>                          delims : in maps.character_set) is
>       first : positive := 1;
>       last  : natural := 0;
>    begin
>       fixed.find_token (str,
>                         delims,
>                         ada.strings.outside,
>                         first,
>                         last);
>
>       -- if last = 0 there are no more tokens, so we stop,
>       -- otherwise we recur!
>       --
>       if last > 0 then
>          ada.text_io.put (str(first..last) & " & ");
>
>          what_words (str (last + 1..str'last),
>                      delims);
>       end if;
>    end what_words;





  reply	other threads:[~2002-05-19 23:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-19 15:15 Tokens ProLogic
2002-05-19 16:32 ` Tokens Pascal Obry
2002-05-19 21:23   ` Tokens ProLogic
2002-05-19 21:48   ` Tokens ProLogic
2002-05-19 23:13     ` An example was Tokens chris.danx
2002-05-19 23:30       ` chris.danx [this message]
2002-05-20  3:44         ` David C. Hoos, Sr.
2002-05-20  1:36       ` ProLogic
replies disabled

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