Return to Snippet

Revision: 23522
at February 8, 2010 20:26 by mhulse


Updated Code
private function uint2hex(dec:uint):String {
	
	// http://blog.rcq129.com/coding/as3-uint-to-hex/
	
	var digits:String = "0123456789ABCDEF";
	var hex:String = '';
	
	while (dec > 0) {
		
		var next:uint = dec & 0xF;
		dec >>= 4;
		hex = digits.charAt(next) + hex;
		
	}
	
	if (hex.length == 0) hex = '0'
	
	return hex;
	
}

Revision: 23521
at February 8, 2010 20:24 by mhulse


Initial Code
function uint2hex(dec:uint) : String { var digits:String = "0123456789ABCDEF"; var hex:String = ''; while (dec > 0) { var next:uint = dec & 0xF; dec >>= 4; hex = digits.charAt(next) + hex; } if (hex.length == 0) hex = '0' return hex; }

Initial URL
http://blog.rcq129.com/coding/as3-uint-to-hex/

Initial Description

                                

Initial Title
AS3: uint to hex

Initial Tags

                                

Initial Language
ActionScript 3