Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] converting I.P. Addresses to integer Re:

From: larry:ecotope at: 31-Jul-2000 23:33

Hi Tim
>> tup-to-num 207.69.132.8
== 3477439496 HTH -Larry -----------code------------------- REBOL [ Title: "Convert IP to number" Author: "Larry Palmiter" Date: 31-Jul-2000 File: %tup-to-num.r Comment: { Must be decimal because REBOL does not support 32 bit unsigned. Assumes 4 items in tuple } ] tup-to-num: func [x /local out][ out: 0.0 x: head reverse parse to-string x "." repeat j 4 [ out: out + (256.0 ** (j - 1) * to-integer x/:j) ] ]