Public Function RomanToArabic( _ ByVal vRomanNumber As Variant _ ) As Variant
RomanToArabic("MM") = 2000 RomanToArabic("MCMXCIX") = 1999 RomanToArabic("MCMXCVI") = 1996 RomanToArabic("mccxxxMvDLXVII") = 1234567 RomanToArabic("CXXIII") = 123 RomanToArabic("IVIIIVII") = 12 ' #6 IsNull(RomanToArabic("234")) = True IsNull(RomanToArabic("IVC23")) = TrueSee also:
ArabicToRoman Function ArabicDigitToRoman FunctionNote: In the Roman numeral system, a line across the top of the letter means multiply by 1,000. Since there is no standard computer character for these Roman numerals, this function accepts the lower-case version of the character instead. Upper-case letters have the standard translations (i.e. I = 1, V = 5, X = 10, etc.) and lower-case letters represent the corresponding value times 1,000 (i.e. v = 5,000, x = 10,000, etc.). Any Roman number greater than or equal to 4,000 will contain at least one of these lower-case letters.
vRomanNumber: String containing a Roman number as represented by the upper- and lower-case letters I, V, X, L, C, D, and M. Function returns Null if vRomanNumber is Null or cannot be fixed up to a String.
Return value: The Arabic (base-10) equivalent of the Roman number will be returned as a Long (integer) value.
Note: This function will not complain about ill-formed Roman numbers. For example, it will interpret the Roman number "IVXII" even though that number is ill-formed. See also example #6.
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.