Example #1
0
 // Token: 0x060001F8 RID: 504 RVA: 0x0000BD3F File Offset: 0x00009F3F
 public ItalianCardinalNumberCruncher(int number, GrammaticalGender gender)
 {
     this._fullNumber      = number;
     this._threeDigitParts = ItalianCardinalNumberCruncher.SplitEveryThreeDigits(number);
     this._gender          = gender;
     this._nextSet         = ItalianCardinalNumberCruncher.ThreeDigitSets.Units;
 }
Example #2
0
 // Token: 0x060001FD RID: 509 RVA: 0x0000BF84 File Offset: 0x0000A184
 protected string UnitsConverter(int number)
 {
     if (this._gender == GrammaticalGender.Feminine && this._fullNumber == 1)
     {
         return("una");
     }
     return(ItalianCardinalNumberCruncher.ThreeDigitSetConverter(number, true));
 }
Example #3
0
 // Token: 0x06000200 RID: 512 RVA: 0x0000BFF1 File Offset: 0x0000A1F1
 protected static string BillionsConverter(int number)
 {
     if (number == 1)
     {
         return("un miliardo ");
     }
     return(ItalianCardinalNumberCruncher.ThreeDigitSetConverter(number, false) + " miliardi ");
 }
 public override string Convert(int number, GrammaticalGender gender)
 {
     if (number < 0)
         return "meno " + Convert(Math.Abs(number), gender);
 
     var cruncher = new ItalianCardinalNumberCruncher(number, gender);
     
     return cruncher.Convert();
 }
Example #5
0
        // Token: 0x06000203 RID: 515 RVA: 0x0000C1C0 File Offset: 0x0000A3C0
        public string Convert()
        {
            if (this._fullNumber == 0)
            {
                return("zero");
            }
            if (this._fullNumber <= 9)
            {
                return(ItalianOrdinalNumberCruncher._unitsUnder10NumberToText[this._fullNumber] + this._genderSuffix);
            }
            string words = new ItalianCardinalNumberCruncher(this._fullNumber, this._gender).Convert();

            if (this._fullNumber % 100 == 10)
            {
                words = words.Remove(words.Length - ItalianOrdinalNumberCruncher._lengthOf10AsCardinal) + "decim" + this._genderSuffix;
            }
            else
            {
                words = words.Remove(words.Length - 1);
                int units = this._fullNumber % 10;
                if (units == 3)
                {
                    words += "e";
                }
                else if (units == 6)
                {
                    words += "i";
                }
                int lowestThreeDigits = this._fullNumber % 1000;
                int lowestSixDigits   = this._fullNumber % 1000000;
                if (this._fullNumber % 1000000000 == 0)
                {
                    words = words.Replace(" miliard", "miliard");
                    if (this._fullNumber == 1000000000)
                    {
                        words = words.Replace("un", string.Empty);
                    }
                }
                else if (lowestSixDigits == 0)
                {
                    words = words.Replace(" milion", "milion");
                    if (this._fullNumber == 1000000)
                    {
                        words = words.Replace("un", string.Empty);
                    }
                }
                else if (lowestThreeDigits == 0 && this._fullNumber > 1000)
                {
                    words += "l";
                }
                words = words + "esim" + this._genderSuffix;
            }
            return(words);
        }
Example #6
0
 // Token: 0x060001FF RID: 511 RVA: 0x0000BFCB File Offset: 0x0000A1CB
 protected static string MillionsConverter(int number)
 {
     if (number == 0)
     {
         return(string.Empty);
     }
     if (number == 1)
     {
         return("un milione ");
     }
     return(ItalianCardinalNumberCruncher.ThreeDigitSetConverter(number, true) + " milioni ");
 }
Example #7
0
 // Token: 0x060001FE RID: 510 RVA: 0x0000BFA5 File Offset: 0x0000A1A5
 protected static string ThousandsConverter(int number)
 {
     if (number == 0)
     {
         return(string.Empty);
     }
     if (number == 1)
     {
         return("mille");
     }
     return(ItalianCardinalNumberCruncher.ThreeDigitSetConverter(number, false) + "mila");
 }
Example #8
0
        public string Convert()
        {
            // it's easier to treat zero as a completely distinct case
            if (_fullNumber == 0)
            {
                return("zero");
            }

            if (_fullNumber <= 9)
            {
                // units ordinals, 1 to 9, are totally different than the rest: treat them as a distinct case
                return(_unitsUnder10NumberToText[_fullNumber] + _genderSuffix);
            }

            var cardinalCruncher = new ItalianCardinalNumberCruncher(_fullNumber, _gender);

            var words = cardinalCruncher.Convert();

            var tensAndUnits = _fullNumber % 100;

            if (tensAndUnits == 10)
            {
                // for numbers ending in 10, cardinal and ordinal endings are different, suffix doesn't work
                words = words.Remove(words.Length - _lengthOf10AsCardinal) + "decim" + _genderSuffix;
            }
            else
            {
                // truncate last vowel
                words = words.Remove(words.Length - 1);

                var units = _fullNumber % 10;

                // reintroduce *unaccented* last vowel in some corner cases
                if (units == 3)
                {
                    words += 'e';
                }
                else if (units == 6)
                {
                    words += 'i';
                }

                var lowestThreeDigits = _fullNumber % 1000;
                var lowestSixDigits   = _fullNumber % 1000000;
                var lowestNineDigits  = _fullNumber % 1000000000;

                if (lowestNineDigits == 0)
                {
                    // if exact billions, cardinal number words are joined
                    words = words.Replace(" miliard", "miliard");

                    // if 1 billion, numeral prefix is removed completely
                    if (_fullNumber == 1000000000)
                    {
                        words = words.Replace("un", string.Empty);
                    }
                }
                else if (lowestSixDigits == 0)
                {
                    // if exact millions, cardinal number words are joined
                    words = words.Replace(" milion", "milion");

                    // if 1 million, numeral prefix is removed completely
                    if (_fullNumber == 1000000)
                    {
                        words = words.Replace("un", string.Empty);
                    }
                }
                else if (lowestThreeDigits == 0 && _fullNumber > 1000)
                {
                    // if exact thousands, double the final 'l', apart from 1000 already having that
                    words += 'l';
                }

                // append common ordinal suffix
                words += "esim" + _genderSuffix;
            }

            return(words);
        }
        public string Convert()
        {
            // it's easier to treat zero as a completely distinct case
            if (_fullNumber == 0)
                return "zero";

            if (_fullNumber <= 9)
            {
                // units ordinals, 1 to 9, are totally different than the rest: treat them as a distinct case
                return _unitsUnder10NumberToText[_fullNumber] + _genderSuffix;
            }

            ItalianCardinalNumberCruncher cardinalCruncher = new ItalianCardinalNumberCruncher(_fullNumber, _gender);

            string words = cardinalCruncher.Convert();

            int tensAndUnits = _fullNumber % 100;

            if (tensAndUnits == 10)
            {
                // for numbers ending in 10, cardinal and ordinal endings are different, suffix doesn't work
                words = words.Remove(words.Length - _lengthOf10AsCardinal) + "decim" + _genderSuffix;
            }
            else
            {
                // truncate last vowel
                words = words.Remove(words.Length - 1);

                int units = _fullNumber % 10;

                // reintroduce *unaccented* last vowel in some corner cases
                if (units == 3)
                    words += 'e';
                else if (units == 6)
                    words += 'i';

                int lowestThreeDigits = _fullNumber % 1000;
                int lowestSixDigits = _fullNumber % 1000000;
                int lowestNineDigits = _fullNumber % 1000000000;

                if (lowestNineDigits == 0)
                {
                    // if exact billions, cardinal number words are joined
                    words = words.Replace(" miliard", "miliard");

                    // if 1 billion, numeral prefix is removed completely
                    if (_fullNumber == 1000000000)
                    {
                        words = words.Replace("un", String.Empty);
                    }
                }
                else if (lowestSixDigits == 0)
                {
                    // if exact millions, cardinal number words are joined
                    words = words.Replace(" milion", "milion");

                    // if 1 million, numeral prefix is removed completely
                    if (_fullNumber == 1000000)
                    {
                        words = words.Replace("un", String.Empty);
                    }
                }
                else if (lowestThreeDigits == 0 && _fullNumber > 1000)
                {
                    // if exact thousands, double the final 'l', apart from 1000 already having that
                    words += 'l';
                }

                // append common ordinal suffix
                words += "esim" + _genderSuffix;
            }

            return words;
        }