function StringUtil() {
}

StringUtil.printMonthDay = function(date) {
	// var dateTime = new Date(date);
	var a = date.split(" ");
	var d = a[0].split("-");
	var t = "0:0:0".split(":");
	if(a.count > 0)
		var t = a[1].split(":");
	var dateTime = new Date(d[0],(d[1]-1),d[2],t[0],t[1],t[2]);
	return (dateTime.getMonth() + 1) + "월 " + dateTime.getDate() + "일";
}

StringUtil.getRecordTextWithoutUnit = function(value) {
	var number = Math.floor(value);
	return NumberUtil.numberWithCommas(number);
}

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

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

StringUtil.getNumberStartWithZero = function(number, digitCount) {
	var n = number + '';
	return n.length >= digitCount ? n : new Array(digitCount - n.length + 1).join('0') + n;
}

StringUtil.toKoreanAlphabets = function(text) {
	var cCho = [ 'ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ' ];
	var cJung = [ 'ㅏ', 'ㅐ', 'ㅑ', 'ㅒ', 'ㅓ', 'ㅔ', 'ㅕ', 'ㅖ', 'ㅗ', 'ㅘ', 'ㅙ', 'ㅚ', 'ㅛ', 'ㅜ', 'ㅝ', 'ㅞ', 'ㅟ', 'ㅠ', 'ㅡ', 'ㅢ', 'ㅣ' ];
	var cJong = [ '', 'ㄱ', 'ㄲ', 'ㄳ', 'ㄴ', 'ㄵ', 'ㄶ', 'ㄷ', 'ㄹ', 'ㄺ', 'ㄻ', 'ㄼ', 'ㄽ', 'ㄾ', 'ㄿ', 'ㅀ', 'ㅁ', 'ㅂ', 'ㅄ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ' ];

	var cho, jung, jong;
	var str = text;
	var cnt = str.length;
	var chars = [], cCode;

	for (var i = 0; i < cnt; i++) {
		cCode = str.charCodeAt(i);
		// if (cCode == 32) { continue; } // 한글이 아닌 경우
		if (cCode < 0xAC00 || cCode > 0xD7A3) {
			chars.push(str.charAt(i));
			continue;
		}
		cCode = str.charCodeAt(i) - 0xAC00;
		jong = cCode % 28; // 종성
		jung = ((cCode - jong) / 28 ) % 21; // 중성
		cho = (((cCode - jong) / 28 ) - jung ) / 21; // 초성

		chars.push(cCho[cho], cJung[jung]);
		if (cJong[jong] !== '') {
			chars.push(cJong[jong]);
		}
	}
	return chars;
};

StringUtil.getUnicodeAlphabetCount = function(text) {
	var chars = StringUtil.toKoreanAlphabets(text);
	// console.log('char : ' + chars);

	var doubleJaum = [
		'ㄲ', 'ㅉ', 'ㄸ', 'ㄲ', 'ㅆ',
		'ㄳ', 'ㄵ', 'ㄶ', 'ㄺ', 'ㄻ', 'ㄼ', 'ㄽ', 'ㄾ', 'ㄿ', 'ㅀ', 'ㅄ'
	];
	var doubleMoum = [
		'ㅒ', 'ㅖ',
		'ㅘ', 'ㅙ', 'ㅚ', 'ㅝ', 'ㅞ', 'ㅟ', 'ㅢ'
	];

	var alphabetCount = 0;
	var alphabet;
	for(var i = 0; i < chars.length; i++) {
		alphabet = chars[i];
		if(doubleJaum.indexOf(alphabet) > -1 || doubleMoum.indexOf(alphabet) > -1) {
			// console.log('double alphabet : ' + alphabet);
			alphabetCount += 2;
		}
		else
			alphabetCount++;
	}

	// return chars;
	return alphabetCount;
};

StringUtil.getScoreUnit = function(playingAppID) {
	if(playingAppID == 104)
		return " 초";
	else if(playingAppID < 100)
		return " 타";
	else
		return " 점";
}