Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 169668

Re: vCo : Number to base16 conversion method

$
0
0

I found some code that fits my needs :

 

var hexes = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'];

var min = min || 2;

var nibble;

var outHex='';

do{

nibble = inNumber & 0x0f;

inNumber = inNumber >> 4;

outHex = hexes[nibble] + outHex;

}while( inNumber );

if( outHex.length < min )

{

outHex = new Array(min-outHex.length+1).join('0') + outHex;

}


Viewing all articles
Browse latest Browse all 169668

Trending Articles