public static string RusSpelledOut(this decimal value, bool male) { if (value == 0) { return("ноль"); } if (value >= 1000000000000000) { throw new ArgumentOutOfRangeException("value"); } var str = new StringBuilder(); if (value < 0) { str.Append("минус"); value = -value; } value = value .AppendPeriod(1000000000000, str, "триллион", "триллиона", "триллионов", true) .AppendPeriod(1000000000, str, "миллиард", "миллиарда", "миллиардов", true) .AppendPeriod(1000000, str, "миллион", "миллиона", "миллионов", true) .AppendPeriod(1000, str, "тысяча", "тысячи", "тысяч", false); var hundreds = (int)(value / 100); if (hundreds != 0) { str.AppendWithSpace(_hunds[hundreds]); } var less100 = (int)(value % 100); var frac20 = male ? _frac20Male : _frac20Female; if (less100 < 20) { str.AppendWithSpace(frac20[less100]); } else { var tens = less100 / 10; str.AppendWithSpace(_tens[tens]); var less10 = less100 % 10; if (less10 != 0) { str.Append(" " + frac20[less100 % 10]); } } return(str.ToString()); }