I have this array storing the suffix of some URLs the user is adding:
[U2, U3, U1, U5, U8, U4, U7, U6]
When I do this:
for
I think what you are asking is similar to this one :
http://www.davekoelle.com/alphanum.html
You can break string into pure string and numeric string. for e.g: abc123 would be split into "abc" and "123" You can compare alphabetic string with normal comparison and then to sort "123" such kind of strings, you have two options: 1: Convert it into Integer and then compare 2: If number does not fit in Integer range, you can compare letter by letter.
for eg "123" vs "133" compare "1" and "1" = equal Compare "2" and "3" = greater so "123" < "133".
Option 2 is more accurate and less error proof.