Sort IP List
Bob Sneidar
bobsneidar at iotecdigital.com
Fri Jun 29 11:13:39 EDT 2018
Hi all.
I somehow got on to how to sort IP addresses, seeing they are not real numbers, and read in the dictionary that the sort command is a "stable sort". This occured to me:
function sortIPList pIPList
set the itemdelimiter to "."
sort lines of pIPList numeric by item 4 of each
sort lines of pIPList numeric by item 3 of each
sort lines of pIPList numeric by item 2 of each
sort lines of pIPList numeric by item 1 of each
return pIPList
end sortIPList
Enjoy!
Bob S
More information about the use-livecode
mailing list