Natural sorted list of files
Jonathan M Davis via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Feb 6 09:35:02 PST 2017
On Monday, February 06, 2017 16:43:45 Dmitry via Digitalmars-d-learn wrote:
> Hi. I'm need get list of files in the directory, with natural
> sort, like:
> file_2
> file_8
> file_10
> file_11
> file_20
> file_100
> etc.
>
> Found this https://rosettacode.org/wiki/Natural_sorting#D
> but there is error on ".groupBy!isDigit" (Error: no property
> 'groupBy' for type 'string').
>
> with deleted line it works, but order is incorrect, like:
> file_1
> file_10
> file_11
> file_100
> file_2
> file_20
> etc.
>
> How can I do this?
You have to import std.range to use groupBy.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list