Skip to content

Instantly share code, notes, and snippets.

@0x04
Created September 16, 2019 17:13
Show Gist options
  • Save 0x04/d9c95a8fb2847f44813fe0add9782fe6 to your computer and use it in GitHub Desktop.
Save 0x04/d9c95a8fb2847f44813fe0add9782fe6 to your computer and use it in GitHub Desktop.
Converts A-Z to Mathematical Alphanumeric Symbols
// 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