## Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.

• how to covert roman number to numeric number

# how to covert roman number to numeric number

Contributor ,
Dec 09, 2010 Dec 09, 2010

Copied

hi all

Any idea how to convert roman number(i ii iii......) to numeric number (1 2 3.....)

Mi_D

TOPICS
Scripting

Views

382

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
3 Replies 3
Dec 09, 2010 Dec 09, 2010

Copied

Hey!

I have exactly what you need: http://bit.ly/bFRuoT

Hope that helps!

--

tomaxxi

http://indisnip.wordpress.com/

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Contributor ,
Dec 09, 2010 Dec 09, 2010

Copied

Hi tomaxxi

Thank its working fine

I_D

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Engaged ,
Jul 31, 2021 Jul 31, 2021

Copied

LATEST

Here is the way to convert roman to int and int to roman.

``````RomanToInteger('MCMLXXXII');//MCMLXXXII:1982
IntegerToRoman(1982);//1982:MCMLXXXII

function RomanToInteger(str) {
var map = { 'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000 };
var result = 0;

for (var i = 0; i < str.length; i++) {
if (i && map[str.charAt(i)] > map[str.charAt(i - 1)]) {
result += (map[str.charAt(i)] - (map[str.charAt(i - 1)] * 2));
}
else {
result += map[str.charAt(i)];
}
}
return result;
}

function IntegerToRoman(num) {
var units = ['', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'XI'];
var tens = ['', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC'];
var hundreds = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM'];
var thousands = ['', 'M', 'MM', 'MMM'];

return thousands[parseInt(num / 1000)] +
hundreds[parseInt((num % 1000) / 100)] +
tens[parseInt((num % 100) / 10)] +
units[num % 10];
}``````

-Sumit

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Resources
Learn and Support
Resources
Crash and Slow Performance