Lucee doesn't support array slice syntax like Adobe

Description

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

is duplicated by

Activity

Show:

Luis Majano 19 January 2023 at 18:34

Yes

Pothys - MitrahSoft 19 January 2023 at 12:28

Already have a ticket for this issue https://luceeserver.atlassian.net/browse/LDEV-1813 and I've updated the testcase on that ticket.
pull request: https://github.com/lucee/Lucee/pull/1936

shall I close the ticket as a duplicate?

Duplicate

Details

Assignee

Reporter

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

Flag notifications