i know in theory they are not ordered, so how come its ordering
automatically in alphabetical asending order when the key is a string?

mark

-----Original Message-----
From: Pascal Peters [mailto:[EMAIL PROTECTED]]
Sent: 04 April 2002 10:33
To: CF-Talk
Subject: RE: Structure Sorting


Structures are NOT ordered and there is no way of keeping them oredered. If
you want an order, use an array.

Pascal

-----Original Message-----
From: Mark Smyth [mailto:[EMAIL PROTECTED]]
Sent: donderdag 4 april 2002 11:18
To: CF-Talk
Subject: Structure Sorting


Hi

I'm looping over a list e.g. ("D, C, B, A") and inserting into a structure
as follows:

<cfset list="D,B,C,A">
<cfset struct= structnew()>
<cfloop index="i" list="#list#" delimiters=",">
<cfscript>
StructInsert(struct, i,"");
</cfscript>
</cfloop>

but when I ouput the structure, it is sorted alphabetically by key.  

<cfloop collection="#struct#" item="i">
<cfoutput>#i# #struct[i]#<br></cfoutput>
</cfloop>

So the above code would output:
A
B
C
D

Instead of what i want which is (The same order the elements were in the
original list)
D
B
C
A

Anyone know any way to keep the output order the same as the input order or
are they always automatically sorted?
Thanks
Mark
Mark Smyth 
Developer 
SystemsUnion.Net
00 44 1865 880800 
[EMAIL PROTECTED] 
www.systemsunion.net



______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to