Created
September 11, 2024 18:56
-
-
Save dev001hajipro/f5d01e33a2a048d092486dd57030104d to your computer and use it in GitHub Desktop.
This file contains hidden or 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 characters
/* | |
パをキーボードで入力すると、U+30D1。 | |
通常は使わないが、合成文字のU+309Aは、右上の ゚で、 | |
'ハ: U+30CF' と '゚゚: U+309A'を組み合わせても'パ'(<-これは実際に合成している)が作れる。 | |
ハ: U+30CF | |
゚゚: U+309A | |
ス: U+30B9 | |
ワ: U+30F2 | |
ー: U+30FC | |
ド: U+30C9 | |
パ: U+30D1 | |
ス: U+30B9 | |
ワ: U+30F2 | |
ー: U+30FC | |
ド: U+30C9 | |
*/ | |
/* ['U+30CF : ハ', 'U+309A : ゚', 'U+30B9 : ス', 'U+30EF : ワ', 'U+30FC : ー', 'U+30C9 : ド'] */ | |
/* ['U+30D1 : パ', 'U+30B9 : ス', 'U+30EF : ワ', 'U+30FC : ー', 'U+30C9 : ド'] */ | |
function getUnicodeCodePoints(str) { | |
const codePoints = []; | |
for (let i = 0; i < str.length; i++) { | |
codePoints.push(`U+${str.charCodeAt(i).toString(16).toUpperCase().padStart(4, '0')} : ${str[i]}`); | |
} | |
return codePoints; | |
} | |
// Test the function | |
console.log(getUnicodeCodePoints("パスワード")); | |
console.log(getUnicodeCodePoints("パスワード")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment