[thelist] using array.sort() in JavaScript not handling case correctly

Mike Stenhouse Mike.Stenhouse at spiritsoft.com
Mon Mar 3 09:26:01 CST 2003


Would something like this work?

function SortAscending(a,b){
	return a.toLowerCase() - b.toLowerCase();
}

yourarray.sort(SortAscending);

Just a thought!

Mike

-----Original Message-----
From: Tom Dell'Aringa [mailto:pixelmech at yahoo.com]
Sent: 03 March 2003 15:15
To: thelist at lists.evolt.org
Subject: [thelist] using array.sort() in JavaScript not handling case
correctly


<snip>

    textArray.sort()
    valueArray.sort()
=================================================================

Anyone know how to make it sort the alpha values by alpha no matter
what the case?

TIA

Tom

</snip>

This message contains confidential information and is intended only for the named individual and may not be disseminated without prior permission.  If you are not the named addressee, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this message in error and delete this e-message from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, delayed in transmission, incomplete, or may contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this Message which arise as a result of e-mail transmission.  If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any software or services.

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. http://www.messagelabs.com
________________________________________________________________________



More information about the thelist mailing list