imbue11235 / roman

Roman provides functions for converting arabic to roman numerals and back, in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Roman Test Status Go Reference

Package roman provides functions for converting arabic to roman numerals and back

Motivation

Needed for a work project, and with the lack of a solution that suited my exact needs, I decided to publish this micro package

Installation

$ go get github.com/imbue11235/roman

Usage

Converting arabic to roman numerals

numeral := roman.FromArabic(4) // => "IV"

Converting roman to arabic numerals

numeral := roman.ToArabic("IV") // => 4

Limitations

  • Arabic numerals lower than or equal to 0 cannot be converted and will return an empty string.
  • Arabic numerals higher than 3999 cannot be converted and will be return an empty string, as:
The largest number that can be represented in this notation is 3,999 (MMMCMXCIX)

(Wiki for more information)

License

This project is licensed under the MIT license.

About

Roman provides functions for converting arabic to roman numerals and back, in Go

License:MIT License


Languages

Language:Go 99.5%Language:Makefile 0.5%