Exemplo n.º 1
0
        public override SpelledNumber SpellOrdinal(ulong number, Gender gender = Gender.Neutral)
        {
            if (number < 100)
            {
                return(InnerSpeller.SpellOrdinal(number, gender));
            }

            ulong hundreds = (number / 100) * 100;
            ulong reminder = number % 100;

            if (reminder == 0)
            {
                string ordinalHundredsInWords = GetHundredsOrdinal(hundreds, gender);
                return(new SpelledNumber(ordinalHundredsInWords, false));
            }

            SpelledNumber hundredsInWords = new SpelledNumber(GetHundreds(hundreds), false);

            return(hundredsInWords.Concat(InnerSpeller.SpellOrdinal(reminder, gender)));
        }
Exemplo n.º 2
0
        public override SpelledNumber SpellOrdinal(ulong number, Gender gender = Gender.Neutral)
        {
            if (number < 20)
            {
                return(InnerSpeller.SpellOrdinal(number, gender));
            }

            ulong tens     = (number / 10) * 10;
            ulong reminder = number % 10;

            if (reminder == 0)
            {
                string tensOrdinal = GetTensOrdinal(number, gender);
                return(new SpelledNumber(tensOrdinal, false));
            }

            string tensInWords = GetTens(tens);
            var    tensSpelled = new SpelledNumber(tensInWords, false);

            return(tensSpelled.Concat(InnerSpeller.SpellOrdinal(reminder, gender)));
        }