Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!gatech!prism!loligo!pepke From: pepke@loligo.cc.fsu.edu (Eric Pepke) Newsgroups: comp.sys.mac.programmer Subject: Re: Can anyone answer these Questions? Message-ID: <255@loligo.cc.fsu.edu> Date: 16 Aug 89 18:19:28 GMT References: <840@eutrc3.urc.tue.nl> <13547@polyslo.CalPoly.EDU> Reply-To: pepke@loligo.UUCP (Eric Pepke) Organization: Supercomputer Computations Research Institute Lines: 22 In article <13547@polyslo.CalPoly.EDU> dorourke@polyslo.CalPoly.EDU (David M. O'Rourke) writes: >rcbaem@eutrc3.urc.tue.nl (Ernst Mulder) writes: >>6) [asks about detecting bad #'s using SANE....] > > Well, I know this in in-effiecient but I conver the number from str->binary > and then from binary->str, and see if the two str's are equal, if they are > then you got a #, if not you don't. Better methods anyone?? You're half right. 01 would fail your test but would still be a perfectly valid number. I usually parse the string. However, if you do that, it is almost trivial to assemble the number as you're parsing it, so I tend to avoid SANE's conversions altogether. Eric Pepke INTERNET: pepke@gw.scri.fsu.edu Supercomputer Computations Research Institute MFENET: pepke@fsu Florida State University SPAN: scri::pepke Tallahassee, FL 32306-4052 BITNET: pepke@fsu Disclaimer: My employers seldom even LISTEN to my opinions. Meta-disclaimer: Any society that needs disclaimers has too many lawyers.