Re: find if any memers of a set are in another set (blank line fi nder)?
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Jul 19, 2002
- 379 views
Pete, Good thoughts! > What, if any, cases exist where a byte >32 is *not* text? 255? I *think* that comes out as a space, though I can't imagine why it would be in a text file, which is what I'm concerned with. > In which case: > z=x[i] > if z<0 or z>32 then -- would be my next best bet. > > (and yes, I have not tested it, but I would put money on it being > faster than if x[i]<0 or x[i]>32 ) I had to think about it, also haven't yet tested it, but it would seem you're right, it should be faster, maybe, since the interpreter only has to look inside x once in first example, rather than twice as in the second, & it makes an "or" in both cases? re TAB *in a variable*: > b=" " > c=" " > You & I might stare in disbelief that b is *NOT* = c YES, with b = 8 spaces, and c = 1 tab, although you won't actually *get* to b <> c, since the TAB *in a variable* isn't accepted by the interpreter, it needs \t. Dan Moyer ----- Original Message ----- From: <petelomax at blueyonder.co.uk> To: "EUforum" <EUforum at topica.com> Sent: Friday, July 19, 2002 3:58 PM Subject: Re: find if any memers of a set are in another set (blank line fi nder)? > > On Fri, 19 Jul 2002 04:49:09 -0700, Dan Moyer > <DANIELMOYER at prodigy.net> wrote: > > > > >Derek, > > > >Ok, enough people have said "check each for non white-space" is faster, so > <snip> > My thought is this: > space=#32 > tab=#09 > cr=#13 > lf=#10 > > What, if any, cases exist where a byte <=32 is *not* whitespace. > What, if any, cases exist where a byte >32 is *not* text? > > Hence, replace > >> if find(x[i][k], " \n\t\r") = 0 then > with > if x[i]>32 then --- not blank > > Don't take my word for it, test this out on your data. > Some foreign characters may fail this simple test. > In which case: > z=x[i] > if z<0 or z>32 then -- would be my next best bet. > > (and yes, I have not tested it, but I would put money on it being > faster than if x[i]<0 or x[i]>32 ) > > > 2nd: re tab: > > If your or my code reads: > > a="12345678" > b=" " > c=" " > <use/imagine a non-proportional font where the "s all align> > > then the *compiler* will read b={space=#32}*8, and c=#09 alone. > > You & I might stare in disbelief that b is *NOT* = c > > As a text editor will show the same results when you or I hit the > space bar eight times or the tab key once, I think it is absolutely > correct that the compiler screams "I cannot *KNOW* what you mean" > > IE use \t between quotes rather than the tab key. > > Pete > >