Package com.ibm.icu.text

Examples of com.ibm.icu.text.DecimalFormat


    /*
     * Test method for 'com.ibm.icu.text.DecimalFormat.getMultiplier()'
     */
    public void testGetMultiplier() {
        DecimalFormat df = new DecimalFormat("%000");
        df.setMultiplier(1000);
        assertEquals(1000, df.getMultiplier());
    }
View Full Code Here


    /*
     * Test method for 'com.ibm.icu.text.DecimalFormat.setMultiplier(int)'
     */
    public void testSetMultiplier() {
        DecimalFormat df = new DecimalFormat("%000");
        assertEquals("%012", df.format(.123));
        df.setMultiplier(1000);
        assertEquals("%123", df.format(.123));
    }
View Full Code Here

    /*
     * Test method for 'com.ibm.icu.text.DecimalFormat.getGroupingSize()'
     */
    public void testGetGroupingSize() {
        DecimalFormat df = new DecimalFormat("#,#0.#");
        assertEquals(2, df.getGroupingSize());
    }
View Full Code Here

    /*
     * Test method for 'com.ibm.icu.text.DecimalFormat.setGroupingSize(int)'
     */
    public void testSetGroupingSize() {
        DecimalFormat df = new DecimalFormat("#,##0.##");
        assertEquals("1,234,567.89", df.format(1234567.89));
        df.setGroupingSize(2);
        assertEquals("1,23,45,67.89", df.format(1234567.89));
    }
View Full Code Here

    /*
     * Test method for 'com.ibm.icu.text.DecimalFormat.isDecimalSeparatorAlwaysShown()'
     */
    public void testIsDecimalSeparatorAlwaysShown() {
        DecimalFormat df = new DecimalFormat("#.#");
        df.setDecimalSeparatorAlwaysShown(false);
        assertEquals("1", df.format(1));
        assertEquals("1.2", df.format(1.2));
        df.setDecimalSeparatorAlwaysShown(true);
        assertEquals("1.", df.format(1));
    }
View Full Code Here

    /*
     * Test method for 'com.ibm.icu.text.DecimalFormat.setDecimalSeparatorAlwaysShown(boolean)'
     */
    public void testSetDecimalSeparatorAlwaysShown() {
        DecimalFormat df = new DecimalFormat("#.#");
        df.setDecimalSeparatorAlwaysShown(false);
        assertFalse(df.isDecimalSeparatorAlwaysShown());
        df.setDecimalSeparatorAlwaysShown(true);
        assertTrue(df.isDecimalSeparatorAlwaysShown());
    }
View Full Code Here

    /*
     * Test method for 'com.ibm.icu.text.DecimalFormat.toPattern()'
     */
    public void testToPattern() {
        DecimalFormat df = new DecimalFormat("#,##0.##");
        assertEquals("#,##0.##", df.toPattern());
    }
View Full Code Here

    /*
     * Test method for 'com.ibm.icu.text.DecimalFormat.toLocalizedPattern()'
     */
    public void testToLocalizedPattern() {
        DecimalFormat df = new DecimalFormat("#,##0.##", new DecimalFormatSymbols(Locale.FRANCE));
        assertEquals("#,##0.##", df.toPattern());
        assertEquals("#\u00a0##0,##", df.toLocalizedPattern());
    }
View Full Code Here

    /*
     * Test method for 'com.ibm.icu.text.DecimalFormat.applyPattern(String)'
     */
    public void testApplyPattern() {
        DecimalFormat df = new DecimalFormat("#,##0.##");
        df.applyPattern("#,0.#");
        assertEquals("1,2,3.4", df.format(123.4));
    }
View Full Code Here

    /*
     * 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

TOP

Related Classes of com.ibm.icu.text.DecimalFormat

Copyright © 2018 www.massapicom. 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.