Skip to content

convert real numbers or strings to superscripts and subscripts

License

Notifications You must be signed in to change notification settings

sonosole/SuperSubScripts.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intro

Visitors

This pkg is used to convert real numbers or strings to superscripts and subscripts. Note that some letters have no superscript or subscript in the Unicode format.

Usage

Basically, we provide two simple APIs : sub and super.

Converting from Integer

The two APIs support base kwarg

sub(s::Int; base=10) :: String
super(s::Int; base=10) :: String

see the example below

julia> "X" * sub(321) * "Y" * super(123)
"X₃₂₁Y¹²³"

julia> "X" * sub(5, base=2) * super(1990, base=16)
"X₁₀₁⁷ᶜ⁶"

Converting from Float

The two APIs do NOT support base kwarg

sub(s::AbstracFloat) :: String
super(s::AbstracFloat) :: String

see the example below

julia> "X" * sub(3.21) * "Y" * super(12.3)
"X₃.₂₁Y¹².³"

Converting from String

The two APIs do NOT support base kwarg either

sub(s::AbstracString) :: String
super(s::AbstracString) :: String

see the example below

julia> sub("abcdefghijklmnopqrstuvwxyz0123456789")
"ₐbcdₑfgₕᵢⱼₖₗₘₙₒₚqᵣₛₜᵤᵥwₓyz₀₁₂₃₄₅₆₇₈₉"

julia> super("abcdefghijklmnopqrstuvwxyz0123456789")
"ᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖqʳˢᵗᵘᵛʷˣʸᶻ⁰¹²³⁴⁵⁶⁷⁸⁹"

julia> super("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
  "ᴬᴮCᴰᴱFᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾQᴿSᵀᵁⱽᵂXYZ"

About

convert real numbers or strings to superscripts and subscripts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages