Sort IP List

hh hh at
Fri Jun 29 19:41:32 EDT 2018

Your IP addresses [0-255].[0-255].[0-255].[0-255]
are the hex IP numbers converted to base 256.
So you may try the following sorting function that
converts the IPs from base 256 to base 10 (decimal).

function ip2dec x
  set itemdel to "."
  repeat with i=0 to 3
    add (item 4-i of x)*256^i to y
  end repeat
  return y
end ip2dec

on mouseUp
  put fld "ips" into s
  sort s numeric by ip2dec(each) # <----
  put s into fld "out"
end mouseUp

More information about the Use-livecode mailing list