Skip to content

to superscript

Subhajit Sahu edited this page May 5, 2020 · 1 revision

Convert string to superscript characters, limited support.

Only following characters can be superscripted:

  • () + - 0123456789 =
  • AB DE GHIJKLMNOP R TU W
  • abcdefghijklmnop rstuvwxyz
const toSuperscript = require('@extra-string/to-superscript');
// toSuperscript(<string>)

toSuperscript('hello world');
// 'ʰᵉˡˡᵒ ʷᵒʳˡᵈ'
toSuperscript('DECCAN PLATEAU');
// 'ᴰᴱCCᴬᴺ ᴾᴸᴬᵀᴱᴬᵁ'
'6.626 x 10'+toSuperscript('-34');
// '6.626 x 10⁻³⁴' (Planck's constant)

extra-string

Clone this wiki locally