Get files from directory sorted by name

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Fri Apr 27 14:48:00 UTC 2018


On Thursday, 26 April 2018 at 16:59:45 UTC, Dr.No wrote:
> On Wednesday, 25 April 2018 at 19:25:11 UTC, Jesse Phillips 
> wrote:
>> On Wednesday, 25 April 2018 at 17:34:41 UTC, Dr.No wrote:
>>> Is there something implemented already to get the files from 
>>> directory by name using D or I'm on my own and I have to 
>>> write it myself? I didn't find how do that with dirEntries()
>>
>> I want to add that sorting can be done, if you just call 
>> std.algorithm.sort you'll find that file names with numbers in 
>> them will be sorted as a well strings.
>>
>> Newfile1.txt
>> Newfile10.txt
>> Newfile2.txt
>
> I've had realized that then implemented natural sort

Thats what it was called. Looks like Rosetta Code has an 
implementation.

https://rosettacode.org/wiki/Natural_sorting#D


More information about the Digitalmars-d-learn mailing list