Oh well Les,

this brings up another thought :

If one calls this udf from a script that has NoVarsInStrings activated it would fail !

Maybe I should recode to get rid of that execute() statement ?
Not good for Golf Score but better for reliability ...

like so :



break on

$arr1 = a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
$arr2 = 1,2,3,4,f,g,a,34,42,23,c,z,o,r

"results for arraycomp(); elements that doesn't match:" ? ?
for each $e in arraycomp($arr1$arr2)
    $e ?
next

"results for arraycomp(); matching elements:" ? ?
for each $e in arraycomp($arr1$arr21)
    $e ?
next

get $

;slightly adapted version (not perfect, room for improvement  [Wink]  )

function arraycomp($a1$a2optional $m)
    dim $s
    If $m
        for each $n in $a2
            if ascan($a1,$n) > -1
                $s = $s + ' ' + $n
            endif
        next
    else
        for each $n in $a2
            if ascan($a1,$n) = -1
                $s = $s + ' ' + $n
            endif
        next
    endif
    $arraycomp = split($s)
endfunction



J.

{edit}Oi Lonk, you forgot to mention that I missed the quotes in implicit array declaration [Wink]

[ 25. February 2003, 15:08: Message edited by: jpols ]
_________________________