Converting numbers to and from roman numerals as easy as II+II=IV. Supports ASCII, Unicode and vinculum extensions.
$ dotnet add package Roman-NumeralsConverting numbers to and from roman numerals as easy as II+II=IV.
Available as a package.
There are very few features:
To display: uint to string (representing a Roman numeral)
Console.WriteLine(RomanNumerals.Convert.ToRomanNumerals(123)); // CXXIII
Console.WriteLine(RomanNumerals.Convert.ToRomanNumerals(227, NumeralFlags.Unicode)); // ⅭⅭⅩⅩⅦ
Parsing: string to uint
Console.WriteLine(RomanNumerals.Convert.FromRomanNumerals("IV")); // 4
All methods also works as extension methods:
using RomanNumerals;
var a1 = Convert.ToRomanNumerals(123);
var a2 = 123 .ToRomanNumerals(); // same as above 😍
Formatting is done using the NumeralBuilder class, with several options.
NumeralBuilder implements ICustomFormatter with the following flags:
| Flag | Effect |
|---|---|
0 | Don’t use negative digits (turns 4 to IIII instead of IV) |
V or - or = | Use vinculum notation (turns 1,000 to Ī instead of M, but also 1,000,000 to I̿ or 5,000,000 to V̿) |
' or ` | ` |
u | Use Unicode (subset of Unicode Roman numerals) |
U | Use Unicode plus ligatures (full range of Unicode Roman numerals) |
A | Use ASCII, the default case |
Parsing is done using the NumeralParser class (with less options, because it parses all forms at once).
Read more about roman numerals at