Package java.text

Examples of java.text.DecimalFormat.toPattern()


   
    f1.setMinimumIntegerDigits(0);
    harness.check(f1.toPattern(), "#.00");
   
    f1.setMaximumIntegerDigits(0);
    harness.check(f1.toPattern(), "#.00");
   
    DecimalFormat f2 = new DecimalFormat("#0.#E0");
    harness.check(f2.toPattern(), "#0.#E0");
   
    DecimalFormat f3 = new DecimalFormat("0.#E0");
View Full Code Here


   
    f1.setMaximumIntegerDigits(0);
    harness.check(f1.toPattern(), "#.00");
   
    DecimalFormat f2 = new DecimalFormat("#0.#E0");
    harness.check(f2.toPattern(), "#0.#E0");
   
    DecimalFormat f3 = new DecimalFormat("0.#E0");
    harness.check(f3.toPattern(), "0.#E0");
  }
}
View Full Code Here

   
    DecimalFormat f2 = new DecimalFormat("#0.#E0");
    harness.check(f2.toPattern(), "#0.#E0");
   
    DecimalFormat f3 = new DecimalFormat("0.#E0");
    harness.check(f3.toPattern(), "0.#E0");
  }
}
View Full Code Here

      // There aren't really many tests we can do, since it doesn't
      // seem like any canonical output format is documented.

      DecimalFormat df = new DecimalFormat ("0.##");
      harness.check (df.toPattern (), "#0.##");
      harness.check (df.toLocalizedPattern (), "#0.##");
     
      DecimalFormatSymbols dfs = df.getDecimalFormatSymbols ();
      dfs.setDecimalSeparator (',');
      dfs.setZeroDigit ('1');
View Full Code Here

      df.setDecimalFormatSymbols(dfs);   // dfs is only a copy of the internal
                                         // symbols so pass symbols back to df
      harness.check (df.toLocalizedPattern (), "X1,XX");

      df.applyPattern ("Fr #,##0.##");
      String x1 = df.toPattern ();
      String x2 = df.toLocalizedPattern ();
      harness.check (x1.length (), x2.length ());
      boolean ok = x1.length () == x2.length ();
      for (int i = 0; i < x1.length (); ++i)
    {
View Full Code Here

  }

  public void test2(TestHarness harness
  {
    DecimalFormat f1 = new DecimalFormat("#0.00;(#0.00)");
    harness.check(f1.toPattern(), "#0.00;(#0.00)");
  }

}
View Full Code Here

      {
        final NumberFormat format = NumberFormat.getCurrencyInstance(context.getLocale());
        if (format instanceof DecimalFormat)
        {
          final DecimalFormat decimalFormat = (DecimalFormat) format;
          return decimalFormat.toPattern();
        }
      }

      final DecimalFormat format = new DecimalFormat();
      if (scale != null && precision != null)
View Full Code Here

        format.setMaximumFractionDigits(scale.intValue());
        format.setMinimumFractionDigits(scale.intValue());
        format.setMaximumIntegerDigits(precision.intValue() - scale.intValue());
        format.setMinimumIntegerDigits(1);
      }
      return format.toPattern();
    }
    return null;
  }

  public static boolean isIgnorable(final DataAttributes attributes,
View Full Code Here

  public String getFormatString()
  {
    if (getFormat() instanceof DecimalFormat)
    {
      final DecimalFormat decFormat = (DecimalFormat) getFormat();
      return decFormat.toPattern();
    }
    return null;
  }

  /**
 
View Full Code Here

        element.setAttributeExpression(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, formulaExpression);
      }
      if (format != null)
      {
        final DecimalFormat decimalFormat = (DecimalFormat) format;
        final String formatString = decimalFormat.toPattern();
        element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FORMAT_STRING, formatString);
      }
      element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NULL_VALUE, getNullString());
    }
    else
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.