Re: String filtering



"Steve" <nospam_steved94@xxxxxxxxxxx> writes:

> If you're just looking for simple code, I would suggest using the
> Index and Delete functions in Ada.Strings.Unbounded. Something
> along the lines of:
>
> loop
> deleteIndex := Index( source, charSet, test => outside );
> exit when deleteIndex = 0;
> Delete( source, deleteIndex );
> end loop;
>
> It's not very efficient, but I think it is about as simple as you
> can get. You can probably use Find_Token to get rid of consecutive
> chunks of characters you want to remove, but it would be a little
> bit more messy (and efficient).

Yes, that's interesting, Steve. I wasn't sure what the use of outside
and inside was until now. (It's obvious once you see it, though!)

You'll probably see in subsequent messages that I eventually came up
with a solution that is at least somewhat efficient (thanks to
everyone's input), reasonably straightforward, and does the job for
me.

Cheers,

David


--

David Trudgett
http://www.zeta.org.au/~wpower/

The most basic processes of living things are accomplished by
molecular engines as complex as man's greatest inventions.

-- Jeremy L. Walter, B.S., M.S., Ph.D., Mechanical Engineering.
.