Welcome! Log In Create A New Profile

Advanced

comparing two arrays / array slicing

Posted by BLS 
BLS
comparing two arrays / array slicing
December 31, 2008 08:03PM
hi,
I am looking for a smart way to compare two arrays, respective a subset of two arrays;

Interesting enough :
In case that I use array slicing like :
IF arr[[ 1 TO 3 ]] = arr2[[ 1 TO 3]] // array of unsigned int

WX 12 says Hasta la vista
even a arr[[ 1 TO 3 ]] and pressing the return key is enough....

in C we have the memcmp() function like

memcmp(&arr[0], &arr2[0], 3)

atm I use a workaround similar to ;

PROCEDURE _memcmp(arr1, arr2, len is unsigned int)
//dbgAssertion(TypeVar(arr1) = wlArray and TypeVar(arr2) = wlArray )
 
WHEN EXCEPTION IN
	FOR i = 1 TO len
		IF arr1 <> arr2 THEN
			RESULT False 
		END
	END
	RESULT True
DO
	ExceptionEnable()
	RESULT False
END



But I don't like it. Ideas ?

Bjoern...

Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: