Last active
October 13, 2015 06:33
-
-
Save heshed/c61b40bc8a7a4538a908 to your computer and use it in GitHub Desktop.
josa.js
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
var process_josa = function(str) { | |
var font_cho = Array( | |
'ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', | |
'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ', 'ㅆ', | |
'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ' ); | |
var font_jung = Array( | |
'ㅏ', 'ㅐ', 'ㅑ', 'ㅒ', 'ㅓ', | |
'ㅔ', 'ㅕ', 'ㅖ', 'ㅗ', 'ㅘ', 'ㅙ', | |
'ㅚ', 'ㅛ', 'ㅜ', 'ㅝ', 'ㅞ', 'ㅟ', | |
'ㅠ', 'ㅡ', 'ㅢ', 'ㅣ' ); | |
var font_jong = Array( | |
'', 'ㄱ', 'ㄲ', 'ㄳ', 'ㄴ', 'ㄵ', 'ㄶ', 'ㄷ', 'ㄹ', | |
'ㄺ', 'ㄻ', 'ㄼ', 'ㄽ', 'ㄾ', 'ㄿ', 'ㅀ', 'ㅁ', | |
'ㅂ', 'ㅄ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ' ); | |
var CompleteCode = str.charCodeAt(str.length-1); | |
var UniValue = CompleteCode - 0xAC00; | |
var Jong = UniValue % 28; | |
var josa=""; | |
if (font_jong[Jong] === '') { | |
josa="로"; | |
} else { | |
josa="으로"; | |
} | |
return josa; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment