Hi, I was looking for a sort function that sorts like humans do.
As most sort sort like: 1,11,12,13,14,2,21,23,26,28,3,31,32,35,38,37, Etc
I wanted to have: 1,2,5,7,9,10,155,266,467, Etc
So I made a function that would do just that.
It isn't pretty as im not realy proficiant, but it does the job.
It only works with integers (? Dont know if correct name) Such as -1000-till Infinity
01,02 wont work.
Works realy simple:
Creates an psuado array from CSV
Adds +1 and checks any of the Array components if its in there.
If it is, it adds it to the list, else adds +1 and checks again.
Could be done in reverse with some modification.
Feel free to use, edit, or do whatever you like with it.
This Probably already exists( InsertionSort()) but the Noob(me) can now have a better grasp on how it works xD
#SingleInstance Force SetBatchLine -1 ^K:: MyVar = 60,444,1,5,77,1174,55,83,936,6283,9,10,-1 Msgbox % Sorting(MyVar) return Sorting(Var) { StringLen,Length,Var Loop, Parse, Var, `, { Count := A_Index ; Adds new item to the list Item%Count% := A_LoopField TotalItems := A_Index ; Number of Section Created Tooltip % item%Count% " " TotalItems ; Sleep, 500 index = -10000 ; From What Minus Value you can Re-Arange } While (LengthSorted != Length) ;if length not Equal { index ++ ; Adds +1 Loop % TotalItems ;Loops total Va { CurrentItem := Item%A_Index% if Index in %CurrentItem% ;if Index(2,3,4,5,6,Etc) Equals Item%A_Index% { SortStr .= item%A_Index% "," ;Add to SortStr StringLen,SortedLength,SortStr lengthSorted := SortedLength-1 ;Removes last , For counting purpose Tooltip % SortStr } } } StringTrimRight,SortStr,SortStr,1 ; removes last Comma "," Return SortStr }