Geoff,
There's my new attempt. I haven't tested it thoroughly, but I'm leaving
it at this for tonight.
I'm padding the numbers now, but if the number is padded, I give it an
advantage while sorting.
// OK, not /that/ easy.
function problem4
put
"642,6,4,3;642,6,4,1;642,6,661,4,3;5,50,56;420,42,423;262,26;26,262"
into myData
set the itemDel to ";"
repeat for each item myList in myData
put myList into myOldList
set the itemDel to comma
sort items of myList numeric descending by len(each)
sort items of myList numeric descending by
padded(each,len(item 1 of myList))
replace comma with empty in myList
put myOldList && myList & cr after myNewData
set the itemDel to ";"
end repeat
return myNewData
end problem4
function padded theItem,theLength
set the itemDel to 0
put 0 into item theLength of myNewItem
put theItem into char 1 to len(theItem) of myNewItem
if len(myNewItem) > len(theItem) then add .1 to myNewItem
return myNewItem
end padded
--
Best regards,
Mark Schonewille
Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553
Installer Maker for LiveCode:
http://qery.us/468
Buy my new book "Programming LiveCode for the Real Beginner"
http://qery.us/3fi
LiveCode on Facebook:
https://www.facebook.com/groups/runrev/
On 5/10/2015 02:01, Geoff Canyon wrote:
On Sat, May 9, 2015 at 6:59 PM, Mark Schonewille <
[email protected]> wrote:
Apparently, not as easy as I thought, but that makes it more interesting.
Yeah, I'm now trying to salvage my padding solution, which is better than
the padding solutions he gave on the site, but still wrong.
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode