romannumerals4j

Tiny Java library for formatting and parsing Roman numerals.

OTHER License

Stars
4

romannumerals4j

Tiny Java library for formatting and parsing Roman numerals, sourced from various StackOverflow posts.

Released under CC-BY-SA 3.0.

Usage

Formatting

Formatting numbers (1-3999 only):

import com.github.fracpete.romannumerals4j.RomanNumeralFormat;
...
RomanNumeralFormat f = new RomanNumeralFormat();
System.out.println(f.format(57));

Outputs:

LVII

Parsing

Parsing numbers:

import com.github.fracpete.romannumerals4j.RomanNumeralFormat;
...
RomanNumeralFormat f = new RomanNumeralFormat();
System.out.println(f.parse("LVII"));

Outputs:

57

Maven

Use the following dependency in your Maven project:

<dependency>
    <groupId>com.github.fracpete</groupId>
    <artifactId>romannumerals4j</artifactId>
    <version>0.0.1</version>
</dependency>