Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public static int convertRomanNumeral(string numeral)
{
numeral = numeral.Replace("M", "DD");
numeral = numeral.Replace("CD", "CCCC");
numeral = numeral.Replace("D", "CCCCC");
numeral = numeral.Replace("C", "LL");
numeral = numeral.Replace("XL", "XXXX");
numeral = numeral.Replace("L", "XXXXX");
numeral = numeral.Replace("X", "VV");
numeral = numeral.Replace("IV", "IIII");
numeral = numeral.Replace("V", "IIIII");
return numeral.Length;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment