Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quicksort in coldfusion

Status
Not open for further replies.

ahc142a

Technical User
Aug 4, 2001
30
GB
I want to rearrange the values in an array so that they are in ascending order. Anysort of sorting algorithm would do, but i need to do it in coldfusion, and i do not know how to write recursive functions in coldfusion. Anyone out there know how, or could help ?

Thanx in advance
 
there is a function is coldfusion called arraysort that you can use to sort ascending or descending

the syntax is:

ArraySort(ArrayToSort, order)

where order is either asc or desc

hope this helps !
 
Unfortunately, Arraysort only checks to see if the array is sorted and then returns either 'yes' or 'no'
 
Ok something i forgot to include. there is a sort type that says what information you are sorting. option are:

Numeric
Text
TextNoCase

to make the array sort use this code i have just dug this out and this works.

<CFSET a = ArraySort(yourArray,&quot;numeric&quot;,&quot;Asc&quot;)>

<!--- to output this sorted array --->
<CFSET b = ArrayToList(myArray)>

<CFLOOP LIST=&quot;#b#&quot; INDEX=&quot;i&quot;>
<Cfoutput>
#i#<BR>
</CFOUTPUT>
</CFLOOP>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top