Пример #1
0
        // MaxValue
        // = 2^32
        // = 4,294,967,295
        // = Four Billion Two Hundred Ninety Four Million Nine Hundred Sixty Seven Thousand Two Hundred Ninety Five
        public static string ConvertToWords(this UInt32 value)
        {
            var valueInWords = new StringBuilder();

            if (value == 0)
            {
                valueInWords.Append(_zero);
            }
            else
            {
                value
                .ConvertForPeriod(valueInWords, Period.Billion, BillionPeriodBegin)
                .ConvertForPeriod(valueInWords, Period.Million, MillionPeriodBegin)
                .ConvertForPeriod(valueInWords, Period.Thousand, ThousandPeriodBegin)
                .ConvertForPeriod(valueInWords, Period.Hundred, HundredPeriodBegin)
                .ConvertSubHundred(valueInWords)
                .ConvertSubTwenty(valueInWords);
            }

            return(BuildNumberWord(valueInWords));
        }