Skip to content

Instantly share code, notes, and snippets.

@herrozerro
Last active January 3, 2020 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save herrozerro/8cd78b48110bf1daf4fb31ad79a85319 to your computer and use it in GitHub Desktop.
Save herrozerro/8cd78b48110bf1daf4fb31ad79a85319 to your computer and use it in GitHub Desktop.
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