//한글분해 Map var firstSoundsMap = new Array( "ㄱ", "ㄲ", "ㄴ", "ㄷ", "ㄸ", "ㄹ", "ㅁ", "ㅂ", "ㅃ", "ㅅ", "ㅆ", "ㅇ", "ㅈ", "ㅉ", "ㅊ", "ㅋ", "ㅌ", "ㅍ", "ㅎ"); //초성 var middleSoundsMap = new Array( "ㅏ", "ㅐ", "ㅑ", "ㅒ", "ㅓ", "ㅔ", "ㅕ", "ㅖ", "ㅗ", "ㅗㅏ", "ㅗㅐ", "ㅗㅣ", "ㅛ", "ㅜ", "ㅜㅓ", "ㅜㅔ", "ㅜㅣ", "ㅠ", "ㅡ", "ㅡㅣ", "ㅣ"); //중성 var lastSoundsMap = new Array( "", "ㄱ", "ㄲ", "ㄱㅅ", "ㄴ", "ㄴㅈ", "ㄴㅎ", "ㄷ", "ㄹ", "ㄹㄱ", "ㄹㅁ", "ㄹㅂ", "ㄹㅅ", "ㄹㅌ", "ㄹㅍ", "ㄹㅎ", "ㅁ", "ㅂ", "ㅂㅅ", "ㅅ", "ㅆ", "ㅇ", "ㅈ", "ㅊ", "ㅋ", "ㅌ", "ㅍ", "ㅎ"); //종성 //한글조합 Map var firstSoundsEngMap = new Array( "r", "R", "s", "e", "E", "f", "a", "q", "Q", "t", "T", "d", "w", "W", "c", "z", "x", "v", "g"); //초성 var middleSoundsEngMap = new Array( "k", "o", "i", "O", "j", "p", "u", "P", "h", "hk", "ho", "hl", "y", "n", "nj", "np", "nl", "b", "m", "ml", "l"); //중성 var lastSoundsEngMap = new Array( "r", "R", "rt", "s", "sw", "sg", "e", "f", "fr", "fa", "fq", "ft", "fx", "fv", "fg", "a", "q", "qt", "t", "T", "d", "w", "c", "z", "x", "v", "g"); //종성 function disassembleHangul(strValue, numAcDrt){ var ordinaryVal = ""; //한글분해 정방 var reverseVal = ""; //한글분해 역방 var tempVal = ""; strValue = removeSpace(removeMark(strValue), 0); for(var i = 0; i < strValue.length; i++){ var numCharValue = (strValue.charCodeAt(i) - 0xAC00); //44032 if(numCharValue < 0 || numCharValue > 11172){ //한글이외 및 한글자음 처리 tempVal = strValue.charAt(i); }else{ //한글 처리 tempVal = firstSoundsMap[Math.floor(numCharValue / 588)]; tempVal += middleSoundsMap[Math.floor((numCharValue % 588) / 28)]; tempVal += lastSoundsMap[Math.floor((numCharValue % 588) % 28)]; } ordinaryVal += tempVal; reverseVal = tempVal + reverseVal; } switch(parseInt(numAcDrt)){ case 0: strValue = "" + ordinaryVal + "acField"; break; case 1: strValue = "" + reverseVal + "acFieldR"; break; default: strValue = "" + ordinaryVal + "(acField,acFieldR)"; break; } return strValue; } function assembleHangul(strValue) { // 변수 초기화 var firstSoundsEngMapCode = 0; var middleSoundsEngMapCode = 0; var lastSoundsEngMapCode = 0; var resultValue = ""; for(var idx=0; idx 0) strEffector = " "; strValue = strValue.replace(/^\s*/, "").replace(/\s*$/, ""); //전후공백제거 strValue = replaceRegExp(strValue, "\\s+", strEffector); //공백제거 return strValue; } function removeMark(strValue){ strValue = replaceRegExp(strValue, "[+@=*@<>()`\\,\\[\\]\"'\\\\]", " "); //특수기호제거 strValue = removeSpace(strValue, 1); //공백제거:0(전체공백제거),1(다수공백제거) return strValue; }