Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sort Array by number from string
#1
Hi everybody

I tried to follow http://www.quickmacros.com/forum/showthr...p?tid=6283 to sort my Array by number - I would prefer Descending (highest first)
I will make an array with products in column 0 and the number value in column 1 that I want to order by

My array looks like:
Product1 -> 95
Product2 -> 112

I wish it would look like:
Product2 -> 112
Product1 -> 95



My macro is:
Code:
Copy      Help
ARRAY(str) am.create(2 2)
int i j
am[0 0]="Product1"
am[0 1]="95"
am[1 0]="Product2"
am[1 1]="112"
str d
am.sort(8 sortwordHits &d )

for i 0 am.len(1)
    for j 0 am.len(2)
        out am[i j]

My 'sortwordHits' function to sort by the number is
Code:
Copy      Help
function# param str&a str&b
&a=&a+(3*sizeof(a))
&b=&b+(3*sizeof(b))
ret StrCompare(b a)


thanks everybody for this great community


I have been using Quick Macro for many many years, it truely is #1 for task automation


Messages In This Thread
Sort Array by number from string - by TheDane - 08-01-2018, 01:22 PM
RE: Sort Array by number from string - by TheDane - 08-02-2018, 06:33 AM
RE: Sort Array by number from string - by Kevin - 08-02-2018, 08:16 AM
RE: Sort Array by number from string - by TheDane - 08-08-2018, 10:21 AM

Forum Jump:


Users browsing this thread: 6 Guest(s)