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: 103376,8f802583e5c84fa X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!news.linkpendium.com!news.linkpendium.com!newsfeed.pacific.net.au!nasal.pacific.net.au!not-for-mail Newsgroups: comp.lang.ada Subject: Re: String filtering From: David Trudgett Organization: Very little? References: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux) Message-ID: Cancel-Lock: sha1:fUga9xJ45ucLa3a4bSELkObYIWg= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 28 Sep 2005 12:20:04 +1000 NNTP-Posting-Host: 61.8.46.192 X-Complaints-To: news@pacific.net.au X-Trace: nasal.pacific.net.au 1127874283 61.8.46.192 (Wed, 28 Sep 2005 12:24:43 EST) NNTP-Posting-Date: Wed, 28 Sep 2005 12:24:43 EST Xref: g2news1.google.com comp.lang.ada:5219 Date: 2005-09-28T12:20:04+10:00 List-Id: "Steve" 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.