Outputs uint32 as a comma-separated list of bytes - Node.js Number

Node.js examples for Number:Binary

Description

Outputs uint32 as a comma-separated list of bytes

Demo Code

function getU8str(u)
{
  var str = "", s;
  for(var i=0; i < 4; i++, u >>>= 8) {
    s = (u & 0xff).toString(16);
    if (s.length < 2) s = "0" + s;
    str += s + (i < 3 ? ",":"");
  }/*w  ww  .jav a2 s  . c  om*/
  
  return str;
}

Related Tutorials