Small util functions to validate Roman numerals, and to convert Roman numerals into the decimal numeral system and vice versa. Because of strict limitation of the Roman numeric system to represent the numerals, such as M, D, C, L, X, V, and I, the maximum roman numeral is “MMMCMXCIX” (3999). I have used recursion algorithm in the toDecimal function to make that function even smaller.

Upon checking several blogs and forums, I decided to create my own converter as the existing ones where either not readable, or they were buggy, or worse, they didn’t comply with the standard Roman numeric system (e.g. you could write the symbols such as M more than the standardized three times!). For the converter I created, I used React Bootstrap library as the frontend without any reason, just for fun.


React with Bootstrap sample:

Here is the same algorithm for ExtJs:


ExtJs sample: