THEMETRIAL

Convert Numbers To Roman Numerals – Romanice

Author:dkin-om
Views Total:0 views
Official Page:Go to website
Last Update:January 11, 2021
License:MIT

Preview:

Convert Numbers To Roman Numerals – Romanice

Description:

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
$ npm i romanice
import * as Romanice from 'romanice';

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

// From Local
<script src="https://www.cssscript.com/./dist/romanice.min.js"></script>

// From A CDN
<script src="https://cdn.jsdelivr.net/npm/romanice/dist/romanice.min.js"></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);
=> MCCXXXIV

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

NOTE :

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

Only share the source www.themetrial.com

Follow us

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