1. Re: Win32Lib --Duh

"Hawke' (Mike Deland)" wrote:

> >I just noticed the code I sent you was a little sloppy for my standards.. it
> >worked but wasn't well optimized..
> <reaches for his pile of pennies>
>
> >include wildcard.e
> >function range(object data, integer low, integer high)
> >  return data * (data>=low) * (data<=high)
> >end function
> >function isAlpha(sequence data)
> > --checks a string to see if it contains only
> > --valid alpha characters
> > sequence up
> > up = upper(data)
> > if find(0,range(up,'A','Z')) then
> >    return 0
> > end if
> > return 1
> >end function
> the following will produce slightly (but every tick counts, eh?) faster,
> and cleaner resultant code/execution... also, it will work for
> ANY euphoria data type now...
>
> func IsAlpha(object data)
>    obj up
>    up = upper(data)
>    return not find(0,range(up,'A','Z'))
> end func
>
> >function isNumeric(sequence data)
> > --checks a string to see if it contains only
> > --valid numeric characters
> > --Returns: 1 if all numeric
> > --         0 if not.
> >  if find(0,range(data,'0','9')) then
> >     return 0
> >  end if
> >  return 1
> >end function
> ditto above...
>
> func isNum(object data)
>    return not find(0,range(data,'0','9'))
> end func
>
> this is faster because an average if-then statement block
> can take anywhere from 3 to 60, mebbe even 100 ticks
> to process, whereas the not statement is nearer a single tick...
>
> enjoy--Hawke'

LOL!!  I JUST sent an email to this list explaining that before I read this
message!  Hehehehehehehehe.....  *laughs uncontrollably*

I am SOOO stupid..  Hahahahaha

   The AfterBeat

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu