Contents > CFML Reference > ColdFusion Functions > ArraySwap PreviousNext

ArraySwap

Swaps array values of an array at specified positions. This function is more efficient than multiple cfset tags.

True, on successful completion.

Array functions

ArraySwap(array, position1, position2)

Parameter

Description

array

Name of an array

position1

Position of first element to swap

position2

Position of second element to swap

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

Contents > CFML Reference > ColdFusion Functions > ArraySwap PreviousNext

ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functa18.htm