function NumberUtil() {
}


NumberUtil.numberWithCommas = function(x) {
	return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}

NumberUtil.numberOfDigits = function(number) {
	if(number === 1000)
		return 4;

	return Math.floor(Math.log(number) / Math.LN10 + 1);	// bug : 1000 -> expected 4 but 3
}

NumberUtil.getRecordText = function(value) {
	var number = Math.floor(value);
	var numberWithCommas = NumberUtil.numberWithCommas(number);

	if(isTypingGameApp())
		return numberWithCommas + " 타";
	else
		return numberWithCommas + " 점";
}


NumberUtil.hexToRGB = function(hexCode) {
	var hex = "";
	if(hexCode.length == 4)
		hex = "#" + hexCode[1] + hexCode[1] + hexCode[2] + hexCode[2] + hexCode[3] + hexCode[3];

	var hexValue = "0x" + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3];
	// console.log(hexCode);
	// console.log(hexValue);
	return hexValue;
}

