Add human sorting option

Description

The different sorting functions provide an option to specify the type of sorting to apply, which can currently be either numeric, text, or textnocase.

This option should be extended by a natural value to allow human-like sorting, i.e. sorting numbers in strings by their value.

E.g.:

Code:

<cfset testArray = ["foo100", "foo1", "foo10", "foo2", "foo20"]> <cfset arraySort(testArray, "natural")> <cfdump var="#testArray#">

Output:

Array
1 string foo1
2 string foo2
3 string foo10
4 string foo20
5 string foo100

Activity

Show:

Zac Spitzer 25 January 2021 at 10:01
Edited

this would be really useful, and would simplify at lot of the version sorting in the update provider and admin code

needs to support both humanand humannocase

it should be implemented in java and not as a UDF comparator for better performance

https://github.com/lucee/Lucee/blob/6.0/core/src/main/java/lucee/commons/lang/ComparatorUtil.java

http://www.davekoelle.com/files/AlphanumComparator.java

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 3 April 2018 at 09:24
Updated 16 February 2021 at 16:35

Flag notifications