I am mainly concerned about scenarios all have a similar name “TestFile .” but if the solutions also support different files names that would be great - like this:
For example, I never try searching for anything with it because I’m getting pretty old now and I don’t think I’ll live long enough for Explorer to find files which match my search criteria in my lifetime.
(I use Everything from Void Tools which shows how quick it could be if Microsoft put some effort into it).
Ironically the reason I knew about Natural Search Order was because a user asked me to implement it on a screen recently despite me arguing there was nothing wrong with the old sort order.
They won, of course, due to the need for money outweighing the need for me to be right.
function StrCmpLogicalW(psz1, psz2: PWideChar): Integer; stdcall; external 'shlwapi.dll';
procedure SortStringArray(var StringArray: TArray<string>);
var
Comparer: IComparer<string>;
begin
Comparer := TComparer<string>.Construct(
function(const Left, Right: string): Integer
begin
Result := StrCmpLogicalW( PWideChar(Left.ToLower), PWideChar(Right.ToLower) );
end
);
TArray.Sort<string>(StringArray, Comparer); // Not Case Sensitive with this WinAPI call
end;