Quote from the message
> I want to revearse the way it is stored to
So looping backwards is not the answer to the question. But yes, displaying
is backwards is easy enough.
David L. Penton
"Mathematics is music for the mind, and Music is Mathematics for the
Soul." - J.S. Bach
[EMAIL PROTECTED]
"If you want an ISP with great Network
connectivity and great email,
DON'T use AT&T @Home"
-----Original Message-----
Behalf Of Matthew Todd
Sent: Saturday, February 24, 2001 4:28 AM
I may be missing the obvious but couldn't you just loop through it
backwards.
<CFSET AryLen = ArrayLen(Ary)>
<cfloop from="#arylen# to="1" step="-1" index="i">
<CFOUTPUT>#Ary[i]#</CFOUTPUT>
</cfloop>
Good luck,
Matthew
>From: "David L. Penton" <[EMAIL PROTECTED]>
>Date: Fri, 23 Feb 2001 16:11:04 -0600
>
>Charles,
>
>Use these links to help you out (from the CFDocs):
>http://localhost/cfdocs/CFML_Language_Reference/
> 3_ColdFusion_Functions/lr3_003.htm#1258462
> 3_ColdFusion_Functions/lr3_011.htm#1138964
>
>Good candidate for a custom tag (maybe there already is one for this)
>
>
><!---ArrayReverse.cfm--->
><!---Build new array and decide on how many elements--->
><CFSET Ary = ArrayNew(1) />
><CFSET NumOfElements = 9 />
>
><!---populate array with values and display them--->
><CFLOOP index="i" from="1" to="#NumOfElements#">
> <CFSET Ary[i]=i^2 />
> <CFOUTPUT>#Ary[i]#</CFOUTPUT><br />
></CFLOOP>
><br />
>
><!---get length of array and the midpoint (fixed)--->
><CFSET AryLen = ArrayLen(Ary) />
><CFSET Midpoint = Fix(AryLen/2) />
>
><!---Loop only to midpoint, everthing will be swapped then--->
><CFLOOP index="i" from="1" to="#midpoint#">
> <CFSET temp = ArraySwap(Ary, i, AryLen-i+1) />
></CFLOOP>
>
><!---display new swapped array--->
><CFLOOP index="i" from="1" to="#NumOfElements#">
> <CFOUTPUT>#ary[i]#</CFOUTPUT><br />
></CFLOOP>
>
>
>
>David L. Penton
>"Mathematics is music for the mind, and Music is Mathematics for the
>Soul." - J.S. Bach
>[EMAIL PROTECTED]
>
> "If you want an ISP with great Network
> connectivity and great email,
> DON'T use AT&T @Home"
>
>
>-----Original Message-----
>Behalf Of Charles Crittenden Jr.
>Sent: Friday, February 23, 2001 3:18 PM
>
>Ok
>I am sorry I was not specific on what I was asking I
>am really try to reverse the order of the array for
>example. If my array was stored
>1
>2
>3
>4
>5
>6
>I want to revearse the way it is stored to
>6
>5
>4
>3
>2
>1
>I know there is some javascript I can run called array
>reverse. But is there another way to handle this
-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com
-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org