Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

array sorting

70 views
Skip to first unread message

timepro timesheet

unread,
Oct 14, 2022, 1:44:33 PM10/14/22
to
xlsfiles=adir(diskname()+':\tax\einvoice\'+qrc_in+'\*.xlsx')
or
ADIR(diskname()+':'\tax\einvoice\'+qrc_in+'\*.xlsx', xlsFiles)

-how to get the last dated+time filename from the array?
-how to get the largest size filename from the array?

tia.

poopall

unread,
Oct 20, 2022, 8:33:08 PM10/20/22
to
I hope I am not breaching copy right here, but an example is given in http://www.xHarbour.com Language Guides

or see https://vivaclipper.wordpress.com/2014/01/07/asort/

Examples

// sort numeric values in ascending order
ASort( { 3, 1, 4, 42, 5, 9 } ) // result: { 1, 3, 4, 5, 9, 42 }

// sort character strings in descending lexical order
aKeys := { "Ctrl", "Alt", "Delete" }
bSort := {| x, y | Upper( x ) > Upper( y ) }
ASort( aKeys,,, bSort ) // result: { "Delete", "Ctrl", "Alt" }

// sort two-dimensional array according to 2nd element of each pair
aPair := { { "Sun", 8 }, { "Mon", 1 }, { "Tue", 57 }, { "Wed", -6 } }
ASort( aPair,,, {| x, y | x[ 2 ] < y[ 2 ] } )
// result: { { "Wed", -6 }, { "Mon", 1 }, { "Sun", 8 }, { "Tue", 57 } }
0 new messages