Revision: 39629
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 19, 2011 07:36 by cwylie0
Initial Code
// Convert to Roman Numerals // copyright 25th July 2005, by Stephen Chapman http://javascript.about.com // permission to use this Javascript on your web page is granted // provided that all of the code (including this copyright notice) is // used exactly as shown function roman(n,s) { var r = ''; var d; var rn = new Array('IIII','V','XXXX','L','CCCC','D','MMMM'); for (var i=0; i< rn.length; i++) { var x = rn[i].length+1; var d = n%x; r= rn[i].substr(0,d)+r; n = (n-d)/x; } if (s) {r=r.replace(/DCCCC/g,'CM'); r=r.replace(/CCCC/g,'CD'); r=r.replace(/LXXXX/g,'XC'); r=r.replace(/XXXX/g,'XL'); r=r.replace(/VIIII/g,'IX'); r=r.replace(/IIII/g,'IV');} return r; }
Initial URL
http://javascript.about.com/library/blroman.htm
Initial Description
Initial Title
Roman Numeral Converter
Initial Tags
javascript
Initial Language
JavaScript