예제 #1
0
 private void AppendDecimalUnits(StringBuilder result, ThousandBlock modBlock)
 {
     result.Append(" ");
     if (modBlock.IsUnitary())
     {
         result.Append(formato.GetUnidadeDecimalNoSingular());
     }
     else
     {
         result.Append(formato.GetUnidadeDecimalNoPlural());
     }
 }
예제 #2
0
        private void AppendIntegers(StringBuilder result, params ThousandBlock[] blocks)
        {
            bool hasStarted = false;

            for (int i = 0; i < blocks.Length; i++)
            {
                ThousandBlock thousandBlock = blocks[i];
                if (!(hasStarted && thousandBlock.IsZero()))
                {
                    int thousandPower = (blocks.Length - i - 1);
                    if (hasStarted)
                    {
                        if (thousandBlock.IsUnitary())
                        {
                            result.Append(GetAndSeparator());
                        }
                        else
                        {
                            if (thousandPower < 1)
                            {
                                result.Append(GetAndSeparator());
                            }
                            else
                            {
                                result.Append(GetThousandSeparator());
                            }
                        }
                    }

                    result.Append(thousandBlock.ToWords());
                    if (thousandPower > 0)
                    {
                        result.Append(" ");
                        result.Append(GetString("1e" + 3 * thousandPower
                                                + (thousandBlock.IsUnitary() ? "singular" : "plural")));
                    }
                    hasStarted = true;
                }
            }
        }