예제 #1
0
 public override void Format(StringBuilder b, double num)
 {
     if (num < 1.0 || num > 4999.0)
     {
         b.Append(num);
         return;
     }
     num = XslNumber.Round(num);
     for (int i = 0; i < XslNumber.XslNumberFormatter.RomanItem.decValues.Length; i++)
     {
         while ((double)XslNumber.XslNumberFormatter.RomanItem.decValues[i] <= num)
         {
             if (this.uc)
             {
                 b.Append(XslNumber.XslNumberFormatter.RomanItem.ucrDigits[i]);
             }
             else
             {
                 b.Append(XslNumber.XslNumberFormatter.RomanItem.lcrDigits[i]);
             }
             num -= (double)XslNumber.XslNumberFormatter.RomanItem.decValues[i];
         }
         if (num == 0.0)
         {
             break;
         }
     }
 }
                public override void Format(StringBuilder b, double num)
                {
                    if (num < 1 || num > 4999)
                    {
                        b.Append(num);
                        return;
                    }
                    num = XslNumber.Round(num);
                    for (int i = 0; i < decValues.Length; i++)
                    {
                        while (decValues [i] <= num)
                        {
                            if (uc)
                            {
                                b.Append(ucrDigits [i]);
                            }
                            else
                            {
                                b.Append(lcrDigits [i]);
                            }

                            num -= decValues [i];
                        }
                        if (num == 0)
                        {
                            break;
                        }
                    }
                }
예제 #3
0
 private static void alphaSeq(StringBuilder b, double n, char[] alphabet)
 {
     n = XslNumber.Round(n);
     if (n == 0.0)
     {
         return;
     }
     if (n > (double)alphabet.Length)
     {
         XslNumber.XslNumberFormatter.AlphaItem.alphaSeq(b, Math.Floor((n - 1.0) / (double)alphabet.Length), alphabet);
     }
     b.Append(alphabet[((int)n - 1) % alphabet.Length]);
 }
 static void alphaSeq(StringBuilder b, double n, char [] alphabet)
 {
     n = XslNumber.Round(n);
     if (n == 0)
     {
         return;
     }
     if (n > alphabet.Length)
     {
         alphaSeq(b, System.Math.Floor((n - 1) / alphabet.Length), alphabet);
     }
     b.Append(alphabet [((int)n - 1) % alphabet.Length]);
 }