Swaps array values for the specified array at the specified positions. ArraySwap can be used with greater efficiency than multiple CFSETs.
Returns a Boolean TRUE on successful completion.
ArraySwap(array, position1, position2)
Name of the array whose elements you want to swap.
Position of the first element you want to swap.
Position of the second element you want to swap.
<!--- This example shows ArraySwap ---> <HTML> <HEAD> <TITLE>ArraySwap Example</TITLE> </HEAD> <BODY> <H3>ArraySwap Example</H3> <CFSET month = ArrayNew(1)> <CFSET month[1] = "February"> <CFSET month[2] = "January"> <CFSET temp = ArraySwap(month, 1, 2)> <CFSET temp = ArrayToList(month)> <P>Show the results: <CFOUTPUT>#temp#</CFOUTPUT> </BODY> </HTML>