Last active
October 15, 2024 03:22
Revisions
-
kawanet revised this gist
May 10, 2013 . 1 changed file with 9 additions and 9 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,23 +1,23 @@ /** カタカナをひらがなに変換する関数 * @param {String} src - カタカナ * @returns {String} - ひらがな */ function katakanaToHiragana(src) { return src.replace(/[\u30a1-\u30f6]/g, function(match) { var chr = match.charCodeAt(0) - 0x60; return String.fromCharCode(chr); }); } /** ひらがなをカタカナに変換する関数 * @param {String} src - ひらがな * @returns {String} - カタカナ */ function hiraganaToKatagana(src) { return src.replace(/[\u3041-\u3096]/g, function(match) { var chr = match.charCodeAt(0) + 0x60; return String.fromCharCode(chr); }); } -
kawanet renamed this gist
May 10, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
kawanet created this gist
May 10, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ /** カタカナをひらがなに変換する関数 * @param {String} src - カタカナ * @returns {String} - ひらがな */ function katakanaToHiragana(src) { return src.replace(/[\u30a1-\u30f6]/g, function(match){ var chr = match.charCodeAt(0) - 0x60; return String.fromCharCode(chr); }); } /** ひらがなをカタカナに変換する関数 * @param {String} src - ひらがな * @returns {String} - カタカナ */ function hiraganaToKatagana(src) { return src.replace(/[\u3041-\u3096]/g, function(match){ var chr = match.charCodeAt(0) + 0x60; return String.fromCharCode(chr); }); }