Sorts array elements numerically or alphanumerically.
Note If the sort is successful, |
ArraySort(array, sort_type [, sort_order ])
<!--- This example shows ArraySort ---> <html> <head> <title>ArraySort Example</title> </head> <body> <cfquery name = "GetEmployeeNames" datasource = "cfsnippets"> SELECT FirstName, LastName FROM Employees </cfquery> <!--- create an array ---> <cfset myArray = ArrayNew(1)> <!--- loop through the query and append these names successively to the last element ---> <CFLOOP query = "GetEmployeeNames"> <cfset temp = ArrayAppend(myArray, "#FirstName# #LastName#")> </CFLOOP> <!--- show the resulting array as a list ---> <cfset myList = ArrayToList(myArray, ",")> <!--- sort that array descending alphabetically ---> <cfset isSuccessful = ArraySort(myArray, "textnocase", "desc")> ...