string getRomanDigit(int number) { string preview = getRomanDigitPreview(number); foreach (ReplacementPattern r in ReplacementPatternCatalog.GetInstance().GetAll()) { preview = r.Replace(preview); } return(preview); }
public int ConvertToNumber(string roman) { string start = ""; string result = roman; while (start != result) { start = result; foreach (ReplacementPattern r in ReplacementPatternCatalog.GetInstance().GetAll()) { result = r.ReverseReplace(result); } } int number = 0; foreach (char c in result) { number += RomansCatalog.GetInstance().GetOne(c).Value; } return(number); }