Skip to content

Instantly share code, notes, and snippets.

View heeju's full-sized avatar
🎯
Focusing

Heeju Jeong heeju

🎯
Focusing
  • Seoul, Korea
View GitHub Profile
@heeju
heeju / japanese-full-to-half-method.js
Last active March 2, 2023 11:22
Convert full-width Japanese character to half-width ascii character
String.prototype.toHalfWidth = function() {
return this.replace(/[-]/g, function(r){
return String.fromCharCode(r.charCodeAt(0) - 0xFEE0);
});
};
@heeju
heeju / getFinalsCode.js
Last active December 16, 2015 10:19
find Korean word finals(종성) for use postpositions (이/가, 을/를, 은/는).
function getFinalsCode(word) {
return ((parseInt(word.charAt(word.length - 1).charCodeAt(0)) - 44032) % 588) % 28;
}
//0 > no final
//1 > ㄱ
//2 > ㄲ
//3 > ㄳ
//4 > ㄴ
// ...