Skip to content

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

License

Notifications You must be signed in to change notification settings

imbue11235/roman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.