Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Array sorting, a clarification

$
0
0

Hi guys,

I have a multiple array with some information, like name, address, date etc.

 

For example for the birth date, this is the correct ( and fastest, the main thing ) approach?

AutoIt         
#include <Array.au3> Global $aTEMP[15][2] For $x = 1 To UBound($aTEMP, 1) - 1     $aTEMP[$x][1] = StringFormat("%02i", Random(1,31,1)) & "/" & StringFormat("%02i", Random(1,12,1)) & "/" & Random(1960,2015,1)     $aTEMP[$x][0] = $x Next _ArrayDisplay($aTEMP, "ORIGINAL") Local $iDay, $iMonth, $iYear For $x = 1 To UBound($aTEMP, 1) - 1     $iDay = StringLeft($aTEMP[$x][1], 2)     $iMonth = StringMid ($aTEMP[$x][1], 4, 2)     $iYear = StringRight($aTEMP[$x][1], 4)     $aTEMP[$x][1] = $iYear & $iMonth & $iDay Next _ArrayDisplay($aTEMP, "CONVERTED") _ArraySort($aTEMP, 0, 1, 0, 1) _ArrayDisplay($aTEMP, "SORTED") For $x = 1 To UBound($aTEMP, 1) - 1     $iDay = StringRight($aTEMP[$x][1], 2)     $iMonth = StringMid($aTEMP[$x][1], 5, 2)     $iYear = StringLeft($aTEMP[$x][1], 4)     $aTEMP[$x][1] = $iDay & "/" & $iMonth & "/" & $iYear Next _ArrayDisplay($aTEMP, "FINAL")

If yes, for "numbers" i can use always the same method. If not, please provide a better example so i can study it.

 

Second question. If i have a list of file path in a file, how i can sort it in a correct way? I don't think i need to apply directly ArraySort, and yes is always a 2D array like before [number,path] There is an example for 2D path sorting?

 

Thanks for any help


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>