View Full Version : Array Sort
07-27-2002, 07:05 AM
If I have an array that looks like this:
How can I sort it by name?
07-27-2002, 07:45 AM
As much as I hate the site... its what google found first:
And it should do what you want.
07-27-2002, 05:11 PM
07-31-2002, 01:22 AM
Haven't run into that problem in ASP, but if it's an issue (which I don't have time to test at the moment, but if I remember correctly, it's not an issue), you can do the same thing in ASP... heck it's a good thing to know anyway:
myString = UCase(myString)
myString = LCase(myString)
Another hint : use ASP for what it was ment, and SQL and database for what they were ment.
in 99.9% of the cases, you can sort your data before an array whas created with something like
"select * from table where state=1 order by name desc"
like this you can choose the variable and the order (ascending or descending) If you pull it out of a DB, go SQL.
07-31-2002, 03:43 PM
I totally agree with raf. And if you're sorting on an indexed field, sorting should be particularly fast in SQL
08-01-2002, 05:49 AM
Thanks... for some reason it completely slipped my mind to use the ORDER BY statement while reading them into the array. Thanks.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.