G'day:
Consider this code:

<cfscript>
original = [];
original[1] = "Tahi";
original[3] = "Toru";
original[5] = "Rima";
original[7] = "Whitu";
original[9] = "Iwa";
original[11] = "tekau ma tahi";
arrayDeleteAt(original, 11);    // leaves the last element, 10, empty

writeDump(var=original, label="Original data");

new = arraySlice(original, 2, 3);
writeDump(var=new, label="Rua-Wha");

new = arraySlice(original, 4);
writeDump(var=new, label="Wha-Tekau");
</cfscript>

The output is:

Original data - array1Tahi2[undefined array element]3Toru4[undefined array 
element]5Rima6[undefined array element]7Whitu8[undefined array element]9Iwa
10[undefined array element]Rua-Wha - array1Toru2[undefined array element]3
RimaWha-Tekau - array1Rima2[undefined array element]3Whitu4[undefined array 
element]5Iwa6[undefined array element]
Note that the results are incorrect (the correct range for each is in the 
dump label).

It seems OpenBD is skipping over the empty elements when deciding the 
starting point to slice at, but then includes the empty elements in the 
results.  If I say that the start element of the operation is *n*, then 
that's the element it should use, rather than the next nearest populated 
element.  That's a bit random.

-- 
Adam

-- 
online documentation: http://openbd.org/manual/
 http://groups.google.com/group/openbd?hl=en

Reply via email to