Note also that you can simplify to: 256#.69 255 248 210 1174403282 256#.inv 1174403282 NB. inv is defined in stdlib.ijs as ^:_1 69 255 248 210
This isn't such a big deal in this case because you will always want a result of 4 integers even if they are zero. If you were converting say integers of unknown length to their digits and back then it's pretty handy: 10#.inv 1453249 1201 1 4 5 3 2 4 9 0 0 0 1 2 0 1 10#. (1 4 5 3 2 4 9,:0 0 0 1 2 0 1) 1453249 1201 > From: Don Guinn > > Use 256 instead of 255. Each number represents a byte with 256 possible > values. > (4$256)#.69 255 248 210 > 1174403282 > > (4$256)#:1174403282 > 69 255 248 210 > > On Wed, Apr 22, 2009 at 3:15 PM, Lettow, Kenneth wrote: > > > How do you convert a IP address from dotted quad representation to > > integer and back in J? > > > > I was experimenting with base and antibase, but got stuck. > > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
