Not exactly what you'd want :OD

<cfscript>
    function ReverseArray(arr){
        return ListToArray(Reverse(ArrayToList(arguments.arr)));
    }
</cfscript>

<cfset names = ["Bill","Ben","Bob","Barney"]>

<cfdump var="#ReverseArray(names)#">

-----Original Message-----
From: Dominic Watson [mailto:[EMAIL PROTECTED]
Sent: 08 May 2008 17:43
To: CF-Talk
Subject: Re: CF8: Reversing arrays?


> It used to be possible to reverse an array, at least in CF6 and CF7 using
the Reverse method

Reverse() is for reversing a string:

http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/w
whelp.htm?context=ColdFusion_Documentation&file=00000616.htm

Here's a little udf for reversing an array using the Reverse() method:

<cfscript>
    function ReverseArray(arr){
        return ListToArray(Reverse(ArrayToList(arguments.arr)));
    }
</cfscript>

Perhaps there's a better way, i.e. using the java.utils.collection
reverse method that Barney showed, but this seems straightforward to
me.

Dominic

--
Blog it up: http://fusion.dominicwatson.co.uk


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:304917
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to