ArraySort()
Sorts array elements numerically or alphanumerically.
ArraySort( array=object, sortType_or_closure=object, sort_order=string, locale_sensitive=boolean );
Returns: Boolean
Examples
Simple array using sort type and order
SomeArray = ["COLDFUSION","coldfusion","adobe","LucEE","LUCEE"];
arraySort(SomeArray,"text","desc");
dump(SomeArray);
//member function
SomeArray.sort("text","desc");
dump(SomeArray);
SomeArray = [
{name="testemployee", age="32"},
{name="employeetest", age="36"}
];
arraySort(
SomeArray,
function (e1, e2){
return compare(e1.name, e2.name);
}
);
dump(SomeArray);
// member function with closure
SomeArray.sort(
function (e1, e2){
return compare(e1.name, e2.name);
}
);
dump(SomeArray);
See also
- Arrays
- Sorting
- array.sort()
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)