Last active
May 5, 2018 02:09
-
-
Save kjsman/6ec04dcb7de7e57eccf1ab36c462db36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function 숫자(value) { | |
this.value = Number(value); | |
} | |
숫자.prototype.valueOf = function() { return this.value } | |
숫자.prototype.toString = function() { return this.value.toString() } | |
숫자.prototype.toLocaleString = function() { | |
if (this == 0) return '영'; | |
var phonemic = ['','일','이','삼','사','오','육','칠','팔','구']; | |
var unit = ['','','십','백','천','만','십만','백만','천만','억','십억','백억','천억','조','십조','백조']; | |
var ret = ''; | |
var part = new Array(); | |
for (var x=0; x<String(this).length; x++) part[x] = String(this).substring(x,x+1); | |
for (var i=0, cnt = String(this).length; cnt > 0; --cnt,++i) { | |
p = phonemic[part[i]]; | |
p+= (p) ? (cnt>4 && phonemic[part[i+1]]) ? unit[cnt].substring(0,1) : unit[cnt] : ''; | |
ret+= p; | |
} | |
return ret; | |
} | |
function 문장(string) { | |
this.string = String(string); | |
} | |
문장.prototype.valueOf = function() { return this.string } | |
문장.prototype.toString = function() { return this.string.toString() } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment