in reply to Comparison of alphanumeric strings
How do you want them ordered?
The string lt operator simply isn't going to work. sort expects an expression that returns one of three values: less than 0 iff lhs less than rhs, 0 iff lhs equals rhs, and greater than 0 iff lhs greater than rhs. The cmp operator performs that operation for strings and <=> (the spaceship operator) does it for numerical values.
If you want some other comparison you need to roll up your own expression that generates -1, 0 or 1 as appropriate for combinations of lhs and rhs values, but you need to specify the desired sort order before you can code it!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Comparison of alphanumeric strings
by Anonymous Monk on Sep 17, 2009 at 10:45 UTC | |
by GrandFather (Saint) on Sep 17, 2009 at 11:00 UTC | |
by Anonymous Monk on Sep 17, 2009 at 12:18 UTC | |
by GrandFather (Saint) on Sep 17, 2009 at 20:36 UTC | |
by Anonymous Monk on Sep 17, 2009 at 11:28 UTC |