• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Name

ArraySort

Synopsis

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#">


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint