Java Code Examples for java.text.DecimalFormat#setPositiveSuffix()

The following examples show how to use java.text.DecimalFormat#setPositiveSuffix() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DecimalFormatTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
public void test_setPositiveSuffix() throws Exception {
    DecimalFormat format = new DecimalFormat();
    assertEquals("", format.getPositiveSuffix());

    format.setPositiveSuffix("PosSfx");
    assertEquals("PosSfx", format.getPositiveSuffix());
    assertTrue(format.parse("123.45PosSfx").doubleValue() == 123.45);

    format.setPositiveSuffix("");
    assertEquals("", format.getPositiveSuffix());

    format.setPositiveSuffix(null);
    assertNull(format.getPositiveSuffix());
}
 
Example 2
Source File: DecimalFormatTest.java    From j2objc with Apache License 2.0 4 votes vote down vote up
public void test_getPositiveSuffix() {
    DecimalFormat df = new DecimalFormat();
    df.setPositiveSuffix("%");
    assertTrue("Incorrect positive prefix", df.getPositiveSuffix().equals("%"));
}