Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!yale!think!snorkelwacker!tut.cis.ohio-state.edu!ucbvax!SOPHIST.UCHICAGO.EDU!goer From: goer@SOPHIST.UCHICAGO.EDU (Richard Goerwitz) Newsgroups: comp.lang.icon Subject: strip? Message-ID: <9001191613.AA22197@sophist.uchicago.edu> Date: 19 Jan 90 16:13:19 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 37 A snail asked: The question I have is: What is the best way to elminate spaces (or, to generalize, members of a particular cset) from a string while still preserving the order of the remaining characters? I wonder if you are referring to a stripping routine? procedure Strip(s,c) s2 := "" s ? { while s2 ||:= tab(upto(c)) do tab(many(c)) s2 ||:= tab(0) } return s2 end This will work with strings, and I suppose that type conversion will make it work with csets, too. For operations specifically having to do with csets, you can of course say c1 --:= c2 where c1 is the cset you are trying to strip down, and c2 is the cset containing the characters to be removed from it. The trouble here, though, is that, unlike strings, csets are not an ordered sequence of characters (you did say something about "original or- der," didn't you?). I guess I'm confused. If the original order is important, use Strip(s,c), and feed it strings. Does this help? -Richard L. Goerwitz goer@sophist.uchicago.edu goer%sophist@uchicago.bitnet rutgers!oddjob!gide!sophist!goer