sort strings by interpreting them as integrals
Andrej Mitrovic
andrej.mitrovich at gmail.com
Sun Jul 29 19:09:18 PDT 2012
void main()
{
string[] x = ["_100", "_10", "_20"];
sort(x);
writeln(x);
}
result:
["_10", "_100", "_20"]
I need to treat these as if they were integrals, although the
underscore complicates things here since it should be ignored. So the
result I want is:
["_10", "_20", "_100"]
How would you implement that? It could be a nice exercise! :)
More information about the Digitalmars-d-learn
mailing list