Created
September 16, 2019 17:13
-
-
Save 0x04/d9c95a8fb2847f44813fe0add9782fe6 to your computer and use it in GitHub Desktop.
Converts A-Z to Mathematical Alphanumeric Symbols
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 characters
// Converts A-Z to Mathematical Alphanumeric Symbols | |
const toMANS = (s, t = 0) => s.replace(/[a-z]/gi, c => String.fromCodePoint(119808 + t * 52 + c.charCodeAt(0) - (c.charCodeAt(0) < 97 ? 65 : 71))); | |
// Test | |
for (let i = 0; i < 13; i++) console.log(toMANS('Hello World!', i)); | |
// Output | |
// > ๐๐๐ฅ๐ฅ๐จ ๐๐จ๐ซ๐ฅ๐! | |
// > ๐ป๐๐๐๐ ๐๐๐๐๐! | |
// > ๐ฏ๐๐๐๐ ๐พ๐๐๐๐ ! | |
// > ๐ฃ๐บ๐๐๐ ๐ฒ๐๐๐๐น! | |
// > ๐๐ฎ๐ต๐ต๐ธ ๐ฆ๐ธ๐ป๐ต๐ญ! | |
// > ๐๐ข๐ฉ๐ฉ๐ฌ ๐๐ฌ๐ฏ๐ฉ๐ก! | |
// > ๐ฟ๐๐๐๐ ๐๐ ๐ฃ๐๐! | |
// > ๐ณ๐๐๐๐ ๐๐๐๐๐! | |
// > ๐ง๐พ๐ ๐ ๐ ๐ถ๐๐๐ ๐ฝ! | |
// > ๐๐ฒ๐น๐น๐ผ ๐ช๐ผ๐ฟ๐น๐ฑ! | |
// > ๐๐ฆ๐ญ๐ญ๐ฐ ๐๐ฐ๐ณ๐ญ๐ฅ! | |
// > ๐๐๐ก๐ก๐ค ๐๐ค๐ง๐ก๐! | |
// > ๐ท๐๐๐๐ ๐๐๐๐๐! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment