Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!pa.dec.com!decuac!e2big.mko.dec.com!guest From: granoff@vaxwrk.enet.dec.com (Mark H. Granoff) Newsgroups: comp.lang.pascal Subject: Re: wish i could figure this out for myself Message-ID: <1991May3.150243.3793@e2big.mko.dec.com> Date: 3 May 91 15:02:43 GMT References: <1991May3.140719.5931@javelin.sim.es.com> Sender: guest@e2big.mko.dec.com (Guest (DECnet)) Reply-To: granoff@vaxwrk.enet.dec.com (Mark H. Granoff) Organization: Digital Equipment Corporation, Maynard MA Lines: 40 In article <1991May3.140719.5931@javelin.sim.es.com>, tpehrson@javelin.sim.es.com (Tim Clinkenpeel) writes: > >a routine i have makes quite a few checks to see if a given character is in a >set of characters. ... > >procedure imstumped; > type cantsee = set of char; > begin > cantsee:='SWU&#:$'; > if givenkey in cantsee then ... > Close... Try something like this: FUNCTION ValidChar(Ch:Char):Boolean; CONST ValidChars : SET OF Char = ['A'..'Z','a'..'z','0'..'9']; BEGIN ValidChar := Ch IN ValidChars; END; Then you can say, in your code: IF ValidChar(Ch) THEN ... ELSE ... Hope this help. --------------------------------------------------------------------------- Mark H. Granoff | Enterprise Integration Services/Engineering VAXworks --------------------------------------------------------------------------- Digital Equipment Corporation | Internet: granoff@vaxwrk.enet.dec.com 129 Parker Street | Usenet : ...!decwrl!vaxwrk.enet!granoff PKO2-1/M21 | AT&T : +1 508 493 4512 Maynard, MA 01754 | FAX : +1 508 493 2240 --------------------------------------------------------------------------- Opinions herein are my own and do not necessarily reflect those of Digital. ---------------------------------------------------------------------------