Tiny Java library for formatting and parsing Roman numerals.
OTHER License
Tiny Java library for formatting and parsing Roman numerals, sourced from various StackOverflow posts.
Released under CC-BY-SA 3.0.
Formatting numbers (1-3999 only):
import com.github.fracpete.romannumerals4j.RomanNumeralFormat;
...
RomanNumeralFormat f = new RomanNumeralFormat();
System.out.println(f.format(57));
Outputs:
LVII
Parsing numbers:
import com.github.fracpete.romannumerals4j.RomanNumeralFormat;
...
RomanNumeralFormat f = new RomanNumeralFormat();
System.out.println(f.parse("LVII"));
Outputs:
57
Use the following dependency in your Maven project:
<dependency>
<groupId>com.github.fracpete</groupId>
<artifactId>romannumerals4j</artifactId>
<version>0.0.1</version>
</dependency>