Skip to content

Instantly share code, notes, and snippets.

@vancluever
Created February 17, 2017 19:25
Show Gist options
  • Select an option

  • Save vancluever/c0ba7895fd591facfb25b8a1485a4df1 to your computer and use it in GitHub Desktop.

Select an option

Save vancluever/c0ba7895fd591facfb25b8a1485a4df1 to your computer and use it in GitHub Desktop.
IPv4 decimal to dotted quad conversion - https://jsfiddle.net/t7fu2fgy/ - works in Google Apps Script too
function decimalToIPv4(decIpAddr) {
ipBytes = [];
for (i=0;i<=3;i++) {
ipBytes.push((decIpAddr >> 8 * 3 - 8 * i) & 255);
}
return ipBytes.join(".");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment