Duplicate
Details
Details
Assignee
Unassigned
UnassignedReporter
Luis Majano
Luis MajanoLabels
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Priority
Created 13 January 2023 at 12:35
Updated 27 January 2023 at 11:14
Resolved 20 January 2023 at 05:06
Lucee has the arraySlice() method but does not support the slicing literal syntax Adobe supports
Syntax: array[ from : to : step ]
Examples:
animals = ['cat', 'dog', 'fish', 'bison']; //All elements of the array writeDump(animals[:]); // Output: cat dog fish bison //All elements of the array writeDump(animals[1:-1]); // Output: cat dog fish bison //Elements from the first index, to the last but one //At a step of two - i.e., returning every alternate element writeDump(animals[1:-2:2]); // Output: cat fish //The array, in reverse writeDump(animals[-1:1:-1]); // Output: bison fish dog cat