半角の文字コードに0xFEE0を足すやつ。 半角全部いけるらしいので、半角全部版を作った。
// 全部版 半角英数全部functiontoZen(str){return str.replace(/[\u0020-\u007E]/g, c =>String.fromCharCode(c.charCodeAt(0)+0xFEE0));}
動作サンプル
ここに出力するよ
半角の文字コードに0xFEE0を足すやつ。 半角全部いけるらしいので、半角全部版を作った。
// 全部版 半角英数全部functiontoZen(str){return str.replace(/[\u0020-\u007E]/g, c =>String.fromCharCode(c.charCodeAt(0)+0xFEE0));}
動作サンプル