Ejemplo n.º 1
0
        protected string IntegerNumber(string number)
        {
            int           numDigit = number.Length;
            int           pos      = 0;
            string        place    = string.Empty;
            StringBuilder fword    = new StringBuilder();

            if (number.StartsWith("-"))
            {
                fword.Append("Minus");
                number = number.Substring(1);
            }

            while (number.Length > 0)
            {
                if (number.Length == 1)
                {
                    fword.Append(" " + Ones.GetOnes(number));
                    break;
                }
                else if (number.Length == 2)
                {
                    fword.Append(" " + Tens.GetTens(number));
                    break;
                }
                else
                {
                    place = GetPlaceValue(number, out pos);
                }

                if (pos == 1)
                {
                    fword.Append(" " + Ones.GetOnes(number.Substring(0, pos)));
                }
                else if (pos == 2)
                {
                    fword.Append(" " + Tens.GetTens(number.Substring(0, pos)));
                }
                else
                {
                    fword.Append(" " + IntegerNumber(number.Substring(0, pos)));
                }
                fword.Append(" " + place);
                number = number.Substring(pos);
                number = number.TrimStart('0');
            }
            return(fword.ToString().Trim());
        }
Ejemplo n.º 2
0
        protected string AfterDecimal(string number)
        {
            StringBuilder word = new StringBuilder();
            int           i    = 0;

            while (i < number.Length)
            {
                if (number[i] == '0')
                {
                    word.Append(" Zero");
                    i++;
                    continue;
                }
                word.Append(" " + Ones.GetOnes(number[i].ToString()));
                i++;
            }
            return(word.ToString().Trim());
        }
Ejemplo n.º 3
0
        public static string GetTens(int number)
        {
            string name = string.Empty;
            bool   isDone;

            name = GetTensMatched(number, out isDone);
            if (!isDone && number > 0)
            {
                name = GetTensMatched(int.Parse(number.ToString().Substring(0, 1) + "0"), out isDone) + " " + Ones.GetOnes(number.ToString().Substring(1));
            }
            return(name);
        }