Skip to content

Instantly share code, notes, and snippets.

@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);
});
};