From: | John Mason |
Date: | 4 Aug 2001 at 00:10:33 |
Subject: | Re: sort and sortlist |
Hi Steve,
I'm trying to sort a dynamically changing array:-
Sort the list array. I've been playing with the Sortlist command, but it doesn't
work on strings, and all elements of my array are strings. Is there any way to
do this.
I came up with a way of doing this just recently -- I added a .b to the
beginning of the newtype (hopefully you're talking about a list of
newtypes) and when I added items to the list I also added the integer
value of the first character of the string into this .b. Then use
SortList to sort by that value. This works, but it doesn't sort past the
first character of the string. I suppose you could add the remaining
characters as values 1/10th the values for the first character, ie:
sortvalue = asc(1stchar)
sortvalue + asc(2ndchar/10)
sortvalue + asc(3rdchar/100)
or,
for x=1 to len(string)
sortvalue + ( asc(mid$(string,1,1)) / (10 exp x) )
next x
Hope this helps...
John Mason -- ICQ 17931257
http://chebucto.ns.ca/~ah210/Profile.html
Home of Wibby, NewStuff, and Reminder!
---------------------------------------------------------------------
To unsubscribe, e-mail: blitz-list-unsubscribe@netsoc.ucd.ie
For additional commands, e-mail: blitz-list-help@netsoc.ucd.ie