Javascript String hex2bin()

Description

Javascript String hex2bin()


String.prototype.hex2bin = function ()
{

  var i = 0, l = this.length - 1, bytes = []

  for (i; i < l; i += 2)
  {/*from w w  w. j  a  va2 s .c  o m*/
    bytes.push(parseInt(this.substr(i, 2), 16))
  }

  return String.fromCharCode.apply(String, bytes)   

}



PreviousNext

Related