Home

RomanNumerals.jl

Julia package for Roman numerals.

RomanNumeral(num)

A type that represents a Roman numeral.

RomanNumeral objects can be created using Integer or AbstractString objects, or using the @rn_str string macro.

Examples

julia> using RomanNumerals

julia> RomanNumeral(1)
I

julia> RomanNumeral(5)
V

julia> RomanNumeral(9)
IX

julia> RomanNumeral(2019)
MMXIX

String literal

julia> rn"MMXIX"
MMXIX

Arithmetic

julia> I + I
II

julia> V - I
IV

julia> 3X - 2I
XXVIII

julia> M ÷ X
C

Conversion

julia> Int(rn"MMXIX")
2019

julia> string(rn"MMXIX")
"MMXIX"
source
rn"IVXLCDM"

RomanNumeral string literal.

source
RomanNumerals.IConstant.
I

The Roman numeral for 1.

source
RomanNumerals.VConstant.
V

The Roman numeral for 5.

source
RomanNumerals.XConstant.
X

The Roman numeral for 10.

source
RomanNumerals.LConstant.
L

The Roman numeral for 50.

source
RomanNumerals.CConstant.
C

The Roman numeral for 100.

source
RomanNumerals.DConstant.
D

The Roman numeral for 500.

source
RomanNumerals.MConstant.
M

The Roman numeral for 1000.

source