Roman-Numerals
2.0.1
dotnet add package Roman-Numerals --version 2.0.1
NuGet\Install-Package Roman-Numerals -Version 2.0.1
<PackageReference Include="Roman-Numerals" Version="2.0.1" />
paket add Roman-Numerals --version 2.0.1
#r "nuget: Roman-Numerals, 2.0.1"
// Install Roman-Numerals as a Cake Addin #addin nuget:?package=Roman-Numerals&version=2.0.1 // Install Roman-Numerals as a Cake Tool #tool nuget:?package=Roman-Numerals&version=2.0.1
RomanNumerals
Converting numbers to and from roman numerals as easy as II+II=IV.
Available as a package.
What is does
There are very few features:
- Convert integers to roman numerals
- Convert roman numerals to integers
- Use roman numeral ASCII representation (I, II, III, IV)
- Use roman numeral Unicode representation (Ⅰ, Ⅱ, Ⅲ, Ⅳ)
- Use roman numeral vinculum extensions (V̅I̅=6000, I̿I̿=200000, etc.)
- Use roman numeral apostrophus (C|Ɔ=1000, |ƆƆ=5000, CC|ƆƆ=10000, |ƆƆƆ=50000, CCC|ƆƆƆ=100000)
- Use roman numeral apostrophus special characters (ↀ=1000, ↁ=5000, ↂ=10000, ↇ=50000, ↈ=100000)
- Use of positive-only combinations (use ⅠⅠⅠⅠ instead of Ⅳ)
How it works
Simple way
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 😍
With options
Formatting
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 | |
Use apostrophus notation (turns 1,000 to (|) instead of M , but also 10,000 to ((|)) or 50,000 to |))) ) |
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
Parsing is done using the NumeralParser
class (with less options, because it parses all forms at once).
Some documentation
Read more about roman numerals at
- https://en.wikipedia.org/wiki/Roman_numerals for general information
- https://en.wikipedia.org/wiki/Numerals_in_Unicode#Roman_numerals for Unicode information
- https://www.unicode.org/charts/PDF/U2150.pdf for Unicode chart
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.1 is compatible. netstandard1.2 was computed. netstandard1.3 was computed. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 was computed. netstandard2.1 was computed. |
.NET Framework | net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Windows Phone | wpa81 was computed. |
Windows Store | netcore was computed. netcore45 was computed. netcore451 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.0
- No dependencies.
-
.NETStandard 1.1
- NETStandard.Library (>= 1.6.1)
-
net6.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Roman-Numerals:
Package | Downloads |
---|---|
FrenchRepublicanCalendar
Vive la révolution! A few classes to convert from and to French republican calendar (that existed between 1792 and 1806). |
GitHub repositories (6)
Showing the top 5 popular GitHub repositories that depend on Roman-Numerals:
Repository | Stars |
---|---|
Richasy/Bili.Copilot
B站第三方 Windows 桌面客户端,使用 Windows App SDK 构建的原生应用
|
|
CollapseLauncher/Collapse
An Advanced Launcher for miHoYo/HoYoverse Games
|
|
CommunityToolkit/Labs-Windows
A safe space to collaborate and engineer solutions from the prototyping stage all the way through polished finalized component for the Windows Community Toolkit.
|
|
Richasy/Rodel.Agent
支持主流在线 AI 服务的应用
|
|
JitHubApp/JitHubV2
GitHub WinUI Client
|