If you could massage your date to get this format list:
[1: "a 1",10: "a 10",100: "a 100",11: "a 11",12: "a 12",2: "a 2",21:
"a 21"]
and then sort the resulting list, you'd get what you want.
As Sean points out, you could use PRegexXtra to extract the numeric
part from your data:
on NumSort aList
newList = [:]
newList.sort()
repeat with aItem in aList
if PRegEx_Search([aItem], "[0-9]+") > 0 then
aProp = value(PRegEx_GetMatchString())
newList.addProp(aProp,aItem)
end if
end repeat
return newList
end
put numSort(["a 1", "a 10", "a 100", "a 11", "a 12", "a 2", "a 21"])
-- [1: "a 1", 2: "a 2", 10: "a 10", 11: "a 11", 12: "a 12", 21: "a
21", 100: "a 100"]
On 6-jul-2006, at 14:47, julian weaver wrote:
not quite. I should have been more explicit. The list would
initially look more like this
["a 1", "a 10", "a 100", "a 11", "a 12", "a 2", "a 21"]
The question then is after an alphanumeric sort, which is what
mylist.sort() does, i want to do a numeric sort to return :
Mark Hagers
[EMAIL PROTECTED]
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
lingo-l@penworks.com (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]