Skip to content

Instantly share code, notes, and snippets.

@qustosh
Forked from berngp/ipNumericValue.scala
Created April 2, 2013 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qustosh/5294435 to your computer and use it in GitHub Desktop.
Save qustosh/5294435 to your computer and use it in GitHub Desktop.
IPv4 to Numeric Value
"192.168.1.1".split('.').reverse.map(_.toLong).zipWithIndex.map(t => (t._1 << (t._2 * 8L))).reduce(_ | _)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment