[Function] AutoSort : Array sorting

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
joedf
Posts: 8953
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

[Function] AutoSort : Array sorting

23 Jun 2014, 20:59

I call it "AutoSort". ;) code from ASPDM I thought I'd share...
https://github.com/ahkscript/ASPDM/blob ... hk#L68-L75

Code: Select all

AutoSort(Arr) {
    t:=Object()
    for k, v in Arr
        t[RegExReplace(v,"\s")]:=v
    for k, v in t
        Arr[A_Index]:=v
    return Arr
}
Simple, just here to save people a few seconds ;)
Regards
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: [Function] AutoSort : Array sorting

16 Sep 2017, 16:47

Nice one joedf, any particular reason for the regexreplace ?
Thanks for sharing, cheers.
User avatar
joedf
Posts: 8953
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: [Function] AutoSort : Array sorting

17 Sep 2017, 11:01

I don't remember... :b
Something about white space needing to be removed...
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
Delta Pythagorean
Posts: 627
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the US
Contact:

Re: [Function] AutoSort : Array sorting

17 Sep 2017, 11:07

Interesting, I don't see a use for what I do as of right now, but later on I might need it.
Great job.

[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat

User avatar
joedf
Posts: 8953
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: [Function] AutoSort : Array sorting

17 Sep 2017, 17:22

Thanks :+1:
I think I had made this mainly for exporting JSON in a sorted way.
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 220 guests