Package java.text

Examples of java.text.DecimalFormat.toLocalizedPattern()


  public void test(TestHarness harness)
  {
    DecimalFormat f = new DecimalFormat(
        "\u00A4#,##0.00", new DecimalFormatSymbols(Locale.UK)
    );
    harness.check(f.toLocalizedPattern(), "\u00A4#,##0.00");
  }

}
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');
    dfs.setDigit('X');
View Full Code Here

    dfs.setGroupingSeparator('!');
    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();
View Full Code Here

    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

      // 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');
      dfs.setDigit ('X');
View Full Code Here

      dfs.setZeroDigit ('1');
      dfs.setDigit ('X');
      dfs.setGroupingSeparator ('!');
      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 ());
View Full Code Here

                                         // 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)
    {
      char c = x1.charAt(i);
View Full Code Here

     */
    public String getElementPattern(final boolean localized) {
        final Format format = elementFormat;
        if (format instanceof DecimalFormat) {
            final DecimalFormat df = (DecimalFormat) format;
            return localized ? df.toLocalizedPattern() : df.toPattern();
        }
        if (format instanceof SimpleDateFormat) {
            final SimpleDateFormat df = (SimpleDateFormat) format;
            return localized ? df.toLocalizedPattern() : df.toPattern();
        }
View Full Code Here

            final DecimalFormat df = (DecimalFormat) format;
            return localized ? df.toLocalizedPattern() : df.toPattern();
        }
        if (format instanceof SimpleDateFormat) {
            final SimpleDateFormat df = (SimpleDateFormat) format;
            return localized ? df.toLocalizedPattern() : df.toPattern();
        }
        if (format instanceof AngleFormat) {
            return ((AngleFormat) format).toPattern();
        }
        return null;
View Full Code Here

     */
    public void setParameterFromObject(final Object o)
        throws ObjectFactoryException {
        super.setParameterFromObject(o);
        final DecimalFormat format = (DecimalFormat) o;
        setParameter("localizedPattern", format.toLocalizedPattern());
        setParameter("pattern", format.toPattern());
    }

    /**
     * Creates an object (<code>DecimalFormat</code>) based on this description.
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.