sort strings by interpreting them as integrals

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Jul 29 19:55:32 PDT 2012


On 7/30/12, bearophile <bearophileHUGS at lycos.com> wrote:
> import std.stdio, std.algorithm, std.conv;
> void main() {
>      auto data = ["_100", "_10", "_20"];
>      schwartzSort!(s => to!int(s[1 .. $]))(data);
>      writeln(data);
> }

Very nice! Thanks.


More information about the Digitalmars-d-learn mailing list