1. Re: Win32Lib --Duh
Hawke, dont take this the wrong way, but it can be a little ( a really tiny
little ) more elegant. (no offense)
>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...
It doesnt work for all objects: find () does not look into every sequence.
Unfortunately (hey, Robert.. Suggestion), simerlar to find, there is no
'search' that does go into every object (but first examines wether or not
the sequence, when we are searching for a sequence matches). Here is search:
(it returns a sequence of indexes or -1 when nothing is found)
function search (object i, object z)
object result
if equal (i, z) then
return {}
elsif sequence (z) then
for index = 1 to length(z) do
result = search (i, z[index])
if sequence (result) then
return index & result
end for
else
return -1
end if
end function
And it are types now.
>func IsAlpha(object data)
> obj up
> up = upper(data)
> return not find(0,range(up,'A','Z'))
>end func
type alpha (object data)
return sequence(search(0, range(upper(data),'A','Z'))
end type
>func isNum(object data)
> return not find(0,range(data,'0','9'))
>end func
type numeric (object data)
return sequence(search(0, range(data, '0','9'))
end type
-----
Ralf N.
nieuwen at xs4all.nl