aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes Sorting a javascript array Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Sorting a javascript array" Watch "Sorting a javascript array" New topic
Author

Sorting a javascript array

Alan Gibson
Greenhorn

Joined: Nov 23, 2006
Posts: 1
I have an array which contains a mixture of strings and numbers representing an address line. For example "20 Main Street" etc

I have found examples of functions which sort alphabetically or which sort numerically. Using the alphabetic sort would mean that for example "16 Main St", would come before "2 Main Street".

Does anyone have an example of a function which would sort this kind of mixed data satisfactorily?

Thanks in advance
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56157
    
  13

I'd suggest googling for sort alogrithms. Just about any of them could be adapted to Javascript.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Sorting a javascript array
 
Similar Threads
Help needed in how to update info in a randomaccessfile
Rather confused -------External classes!!
LinkedList & Add Method?
Appending two Multidimensional Arrays together
Anagrams