from JsArray.toString() Return $o_SortArry EndIf = original array is 2D from now on = Local $o_ExtColmn 1D array of UNsorted elements For $i = 0 To UBound ( $o_array ) - 1 $o_ExtColmn = $o_array Next Local $o_SortData = $o_Obj. run ( "ArraySorting1D", $o_array, $o_Numeric, $o_ascending ) $o_Obj = 0 Local $o_SortArry = StringSplit ( $o_SortData, ',', 2 ) comma delim. AddCode ( $o_CBlock ) = If $iNb_Cols = 0 Then when original array is 1D Local $o_SortData = $o_Obj. #ce #include #include "3" LarsJ Opt ( "MustDeclareVars", 1 ) Global $g_iRows = 10000, $g_iCols = 6, $g_aArray _Example2 ( ) Func _Example2 ( ) _Generate _All ( $g_aArray ) _ArrayDisplay ( $g_aArray, "UNsorted", Default, Default, Default, _ "Strings|Integers*|Floats*|Dates*|Times*|R/C*" ) Local $hTimer2 = TimerInit ( ) Local $iCol_Sort = 0 Local $x_Result2 = _ArraySortJs ( $g_aArray, $iCol_Sort, False, True ) col $iCol_Sort, numeric (True), ascending (True) If Then Exit Msgbox ( 0, "_ArraySortJs", "error " & ) ConsoleWrite ( "JScript: sorted in = " & Int ( TimerDiff ( $htimer2 ) ) & " ms" & ) _ArrayDisplay ( $x_Result2, "sorted (col " & $iCol_Sort & ")", Default, Default, Default, _ "Strings|Integers*|Floats*|Dates*|Times*|R/C*" ) EndFunc = Func _Generate _All ( ByRef $g_aArray ) LarsJ ConsoleWrite ( "$g_iRows = " & $g_iRows & " $g_iCols = " & $g_iCols & ) $g_aArray = FAS _Random2DArrayAu3 ( $g_iRows, "sifdtr", "abcdefghijklmnopqrstuvwxyz" ) EndFunc =>_Generate_All #FUNCTION# = Name.: _ArraySortJs = Func _ArraySortJs ( $o_array, $o_Column = 0, $o_Numeric = True, $o_ascending = True ) = If Not IsArray ( $o_array ) Then Return SetError ( 1, 0, - 1 ) Local $iNb_Cols = Ubound ( $o_array, 2 ) If ( $iNb_Cols = 1 ) And ( $o_Column > 0 ) Then Return SetError ( 1, 0, - 1 ) If ( $iNb_Cols > 1 ) And ( $o_Column > $iNb_Cols - 1 ) Then Return SetError ( 1, 0, - 1 ) = Local $o_CBlock = _ 'function GetArray(arr)' = Local $ObjErr = ObjEvent ( "AutoIt.Error", "_ErrorHandler" ) Local $o_Obj = 0 $o_Obj = ObjCreate ( "ScriptControl" ) $o_Obj. _ArrayDisplay($x_Result, "sorted (col " & $iCol_Sort & ")") Local $x_Result = _ArraySortJs($arry, $iCol_Sort, False, True) col $iCol_Sort, string, ascending _ArrayDisplay($arry, "UNsorted (col " & $iCol_Sort & ")") $x_Result = _ArraySortJs($arry, 0, False, False) col 0, string, descending Local $x_Result = _ArraySortJs($arry, 0, True, True) col 0, numeric (True), ascending (True)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |