sort strings by interpreting them as integrals

bearophile bearophileHUGS at lycos.com
Sun Jul 29 20:02:25 PDT 2012


Jonathan M Davis:

> And it avoids having to do any conversions like your solution 
> does.<

I understand now, thank you for explaining.
But in general I suggest to avoid using a solution like yours, 
unlesss this sorting is recognized by profiling as important for 
the performance of the program (and unless you add a well tested 
validation pass before your sort). Because sorting numbers as 
strings is a very good source of bugs. So better waste some time 
converting them, and doing things in a tidy way :-) Trust me... 
:-)

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list