Convert Numbers To Roman Numerals – Romanice

Views Total:0 views
Official Page:Go to website
Last Update:January 11, 2021


Convert Numbers To Roman Numerals – Romanice


Romanice is a dependency-free JavaScript library that converts Arabic numbers (1, 2, 3, …) to roman numerals (I, II, III, …) and vice versa.

How to use it:

1. Install and import the Romanice as an ES module.

$ npm i romanice
import * as Romanice from 'romanice';

2. Or load the compiled JavaScript file in the document.

// From Local
<script src=""></script>

// From A CDN
<script src=""></script>

3. Create a standard Roman Numeral converter.

const { romanice } = Romanice;
const standardConverter = romanice();

4. Convert Arabic numbers to roman numerals.

const roman = standardConverter.toRoman(1234);

5. Convert roman numbers to Arabic numerals.

const decimal = standardConverter.fromRoman('MCCXXXIV');
=> 1234

6. Customize the Roman numeral symbols.

const { romanice, symbols } = Romanice;
const unicodeConverter = romanice(symbols.UNICODE);

const roman = unicodeConverter.toRoman(123456);
=> ↂↀↀⅭⅭⅭⅩⅬⅤ

const decimal = unicodeConverter.fromRoman('ↂↀↀⅭⅭⅭⅩⅬⅤ');
=> 123456

Source link

Add comment


All visitors can share my site’s content on their blogs, sites, and social networks to enrich the content

Only share the source

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.