add a number of elements argument to listToArray

Description

Over in Javascript land, they are looking at this option

https://github.com/tc39/proposal-reversible-string-split

## python print('a|b|c|d|e|f'.split('|', 2)) # ['a', 'b', 'c|d|e|f']

Currently, ListToArray() processes the whole string, regardless
https://docs.lucee.org/reference/functions/listtoarray.html

We could add a fifth parameter, (name?) specifying number of elements.

  • when positive, the remaining string gets added as the last array element

  • when negative, nothing more happens, only the first N items get added to the array

This would be useful in terms of performance and memory, as well as being useful when processing complex strings

https://dev.lucee.org/t/adding-a-number-argument-to-listtoarray/9714

Activity

Show:

Details

Assignee

Reporter

Labels

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 18 July 2022 at 09:06
Updated 31 December 2024 at 09:11

Flag notifications