August 2003
Intermediate to advanced
1140 pages
68h 45m
English
ArraySort
ArraySort(array, type[,order])
Sorts
an array based on the sort type
(numeric, text, or
textnocase) and optionally, the sort
order (asc, the
default, or desc). Here’s an
example that sorts the values in an array called
Grades from highest grade to lowest grade in
descending order:
<cfset Grades = ArrayNew(1)> <cfset Grades[1] = "95"> <cfset Grades[2] = "93"> <cfset Grades[3] = "87"> <cfset Grades[4] = "100"> <cfset Grades[5] = "74"> <b>Original Array:</b><br> <cfdump var="#Grades#"> <p>Sort Array... <cfset ArraySort(Grades, "Numeric", "desc")> <p><b>Sorted Array:</b><br> <cfdump var="#Grades#">