order array containing text and numbers
Posted
by ptrn
on Stack Overflow
See other posts from Stack Overflow
or by ptrn
Published on 2010-05-10T11:52:12Z
Indexed on
2010/05/10
11:54 UTC
Read the original article
Hit count: 227
I'm looking for the easiest way to sort an array that consists of numbers and text, and a combination of these.
E.g.
'123asd'
'19asd'
'12345asd'
'asd123'
'asd12'
turns into
'19asd'
'123asd'
'12345asd'
'asd12'
'asd123'
This is going to be used in combination with the solution to another question I've asked here.
The sorting function in itself works, what I need is a function that can say that that '19asd' is smaller than '123asd'.
I'm writing this in JavaScript.
© Stack Overflow or respective owner