Examples of applyLocalizedPattern()


Examples of com.ibm.icu.text.DecimalFormat.applyLocalizedPattern()

    /*
     * Test method for 'com.ibm.icu.text.DecimalFormat.applyLocalizedPattern(String)'
     */
    public void testApplyLocalizedPattern() {
        DecimalFormat df = new DecimalFormat("#,##0.##", new DecimalFormatSymbols(Locale.FRANCE));
        df.applyLocalizedPattern("#\u00a00,#");
        assertEquals("1\u00a02\u00a03,4", df.format(123.4));
    }
}
View Full Code Here

Examples of com.ibm.icu.text.SimpleDateFormat.applyLocalizedPattern()

     * Test method for 'com.ibm.icu.text.SimpleDateFormat.applyLocalizedPattern(String)'
     */
    public void testApplyLocalizedPattern() {
        SimpleDateFormat sdf = new SimpleDateFormat();
        sdf.setTimeZone(tzc);
        sdf.applyLocalizedPattern(hmzmdy);
        assertEquals(hmzmdyStr, sdf.format(date));
    }

    /*
     * Test method for 'com.ibm.icu.text.SimpleDateFormat.getDateFormatSymbols()'
View Full Code Here

Examples of java.text.DecimalFormat.applyLocalizedPattern()

            symbols = new DecimalFormatSymbols(locale);
        }
       
        DecimalFormat format = (DecimalFormat) NumberFormat.getInstance();
        format.setDecimalFormatSymbols(symbols);
        format.applyLocalizedPattern(pattern);
        return format.format(number);
    }

    private void assertArgCount(int count) {
        if (getArgumentCount() != count) {
View Full Code Here

Examples of java.text.DecimalFormat.applyLocalizedPattern()

        // if some constructors default pattern to null, it makes only sense
        // to handle null pattern gracefully
        if (pattern != null) {
            if (locPattern) {
                formatter.applyLocalizedPattern(pattern);
            } else {
                formatter.applyPattern(pattern);
            }
        } else {
            log.debug("No pattern provided, using default.");
View Full Code Here

Examples of java.text.DecimalFormat.applyLocalizedPattern()

        DecimalFormat numberFormat = (DecimalFormat) NumberFormat.getInstance(locale);

        // if some constructors default pattern to null, it makes only sense to handle null pattern gracefully
        if (pattern != null) {
            if (locPattern) {
                numberFormat.applyLocalizedPattern(pattern);
            } else {
                numberFormat.applyPattern(pattern);
            }
        } else {
            log.debug("No pattern provided, using default.");
View Full Code Here

Examples of java.text.DecimalFormat.applyLocalizedPattern()

    // try null argument
    boolean pass = false;
    try
    {
      f1.applyLocalizedPattern(null);
    }
    catch (NullPointerException e)
    {
      pass = true;  
    }
View Full Code Here

Examples of java.text.DecimalFormat.applyLocalizedPattern()

   
    // try illegal pattern
    pass = false;
    try
    {
      f1.applyLocalizedPattern(";;");
    }
    catch (IllegalArgumentException e)
    {
      pass = true;  
    }
View Full Code Here

Examples of java.text.DecimalFormat.applyLocalizedPattern()

            }
           
                // create one if cache missed, set the pattern
            fmt = (DecimalFormat)NumberFormat.getNumberInstance(locale);
            if (!StringUtil.nullOrEmptyString(pattern)) {
                fmt.applyLocalizedPattern(pattern);
            }
           
                // cache it & return
            cache.put(locale, pattern, fmt);
            return fmt;
View Full Code Here

Examples of java.text.DecimalFormat.applyLocalizedPattern()

    protected Format instantiateFormat (int type, Locale locale, String pattern)
    {
        pattern = (pattern == null) ? "" : pattern;
        DecimalFormat fmt = (DecimalFormat)NumberFormat.getNumberInstance(locale);
        if (!StringUtil.nullOrEmptyString(pattern)) {
            fmt.applyLocalizedPattern(pattern);
        }
        fmt.setGroupingUsed(true);
        return fmt;
    }
View Full Code Here

Examples of java.text.DecimalFormat.applyLocalizedPattern()

    protected Format instantiateFormat (int type, Locale locale, String pattern)
    {
        pattern = (pattern == null) ? "" : pattern;
        DecimalFormat fmt = (DecimalFormat)NumberFormat.getNumberInstance(locale);
        if (!StringUtil.nullOrEmptyString(pattern)) {
            fmt.applyLocalizedPattern(pattern);
        }

        // set this to false so we can detect fractional values and throw exception
        // see parseInt()
        fmt.setParseIntegerOnly(false);
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.