private string GetCheckAnnotation(string numberText)
        {
            // Split the left side of the decimal
            // and the right side of the variable to
            // spell out the numbers seperately.
            var parts    = numberText.Split('.');
            var leftSide = long.Parse(parts[0]);

            long rightSide = 0;

            if (parts.Length == 2)
            {
                // Grab two decimal points if
                // they exist.
                rightSide = long.Parse(parts[1]);
                if (parts[1].Length > 2)
                {
                    rightSide = long.Parse(parts[1].Substring(0, 2));
                }
            }

            // Left side is the text, and the right side
            // is a fraction.
            var leftSideText  = _speller.Spell(leftSide);
            var rightSideText = rightSide + "/100";

            var dollars = IncludeWordDollars ? " dollars" : "";
            var cents   = IncludeWordCents ? " cents" : "";

            return(_textTransformer.Transform(leftSideText + dollars + " and " + rightSideText + cents));
        }
        private string AddOptions(int originalNumber, string[] didgetWords)
        {
            // Add the word and to the number to make the number sound more
            // natural. Ex. instead of "five hundred fifteen", "five hundred and fifteen".
            var numberTextWithAnd = AddAnd(originalNumber, didgetWords);

            // Decimal grouping text would be like appending thousand or million.
            //  ex. three hundred million ... or ... five hundred and fifteen thousand.
            var numberTextWithGroupText = AddDecimalGroupingText(numberTextWithAnd);

            var fullNumberText = string.Join(" ", numberTextWithGroupText);

            return(_textTransformation.Transform(fullNumberText));
        }
        /// <summary>
        /// Splits the number into
        /// </summary>
        /// <param name="number"></param>
        /// <returns></returns>
        private string ToNumberText(string number)
        {
            var  parts = number.Split('.');
            long leftSide;
            long rightSide;

            if (parts.Length == 1)
            {
                leftSide  = long.Parse(parts[0]);
                rightSide = 0;
            }
            else
            {
                leftSide  = long.Parse(parts[0]);
                rightSide = long.Parse(parts[1]);
            }

            var leftSideString  = _speller.Spell(leftSide);
            var rightSideString = _speller.Spell(rightSide);

            return(_textTransformer.Transform(
                       leftSideString + " point " + rightSideString));
        }
        public string Spell(ulong number)
        {
            var longText          = number.ToString();
            var len               = longText.Length;
            var nextStartingIndex = 0;

            var numberParts = new List <string>();

            // Septillions
            if (len >= 19)
            {
                var substring = longText.Substring(nextStartingIndex, len + 3 - 21);
                nextStartingIndex = len % 3;
                var trimmedNumber = int.Parse(substring);
                var helper        = new NumberToTextSpellingHelper(DecimalPosition.Septillions, _textTransformer);
                var text          = helper.GetText(trimmedNumber);
                if (trimmedNumber > 0)
                {
                    numberParts.Add(text);
                }
            }
            // Quadrillions
            if (len >= 16)
            {
                var forHowMany = len >= 18 ? 3 : len + 3 - 18;
                var substring  = longText.Substring(nextStartingIndex, forHowMany);
                nextStartingIndex += forHowMany;
                var trimmedNumber = int.Parse(substring);
                var helper        = new NumberToTextSpellingHelper(DecimalPosition.Quadrillions, _textTransformer);
                var text          = helper.GetText(trimmedNumber);
                if (trimmedNumber > 0)
                {
                    numberParts.Add(text);
                }
            }
            // Trillions
            if (len >= 13)
            {
                var forHowMany = len >= 15 ? 3 : len + 3 - 15;
                var substring  = longText.Substring(nextStartingIndex, forHowMany);
                nextStartingIndex += forHowMany;
                var trimmedNumber = int.Parse(substring);
                var helper        = new NumberToTextSpellingHelper(DecimalPosition.Trillions, _textTransformer);
                var text          = helper.GetText(trimmedNumber);
                if (trimmedNumber > 0)
                {
                    numberParts.Add(text);
                }
            }
            // Billions
            if (len >= 10)
            {
                var forHowMany = len >= 12 ? 3 : len + 3 - 12;
                var substring  = longText.Substring(nextStartingIndex, forHowMany);
                nextStartingIndex += forHowMany;
                var trimmedNumber = int.Parse(substring);
                var helper        = new NumberToTextSpellingHelper(DecimalPosition.Billions, _textTransformer);
                var text          = helper.GetText(trimmedNumber);
                if (trimmedNumber > 0)
                {
                    numberParts.Add(text);
                }
            }
            // Millions
            if (len >= 7)
            {
                var forHowMany = len >= 9 ? 3 : len + 3 - 9;
                var substring  = longText.Substring(nextStartingIndex, forHowMany);
                nextStartingIndex += forHowMany;
                var trimmedNumber = int.Parse(substring);
                var helper        = new NumberToTextSpellingHelper(DecimalPosition.Millions, _textTransformer);
                var text          = helper.GetText(trimmedNumber);
                if (trimmedNumber > 0)
                {
                    numberParts.Add(text);
                }
            }
            // Thousands
            if (len >= 4)
            {
                var forHowMany = len >= 6 ? 3 : len + 3 - 6;
                var substring  = longText.Substring(nextStartingIndex, forHowMany);
                nextStartingIndex += forHowMany;
                var trimmedNumber = int.Parse(substring);
                var helper        = new NumberToTextSpellingHelper(DecimalPosition.Thousands, _textTransformer);
                var text          = helper.GetText(trimmedNumber);
                if (trimmedNumber > 0)
                {
                    numberParts.Add(text);
                }
            }
            // Ones
            if (len >= 1)
            {
                var forHowMany    = len >= 3 ? 3 : len;
                var substring     = longText.Substring(nextStartingIndex, forHowMany);
                var trimmedNumber = int.Parse(substring);
                var helper        = new NumberToTextSpellingHelper(DecimalPosition.Ones, _textTransformer);
                var text          = helper.GetText(trimmedNumber);

                if (text.ToLower() == "zero")
                {
                    if (numberParts.Count == 0)
                    {
                        numberParts.Add(text);
                    }
                }
                else
                {
                    if (substring.Length <= 2 && numberParts.Count > 0)
                    {
                        numberParts.Add("and");
                    }
                    numberParts.Add(text);
                }
            }

            var fullText = string.Join(" ", numberParts);

            return(_textTransformer.Transform(fullText));
        }