Java Code Examples for com.ibm.icu.text.DecimalFormat#applyPattern()
The following examples show how to use
com.ibm.icu.text.DecimalFormat#applyPattern() .
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: JavaNumberFormatSpecifierImpl.java From birt with Eclipse Public License 1.0 | 6 votes |
public String format( Number number, ULocale lo ) { Number n = NumberUtil.transformNumber( number ); if ( n instanceof Double ) { return format( ( (Double) n ).doubleValue( ), lo ); } // Format big decimal BigDecimal bdNum = (BigDecimal) n; final DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance( lo ); String vPattern = NumberUtil.adjustBigNumberFormatPattern( getPattern( ) ); if ( vPattern.indexOf( 'E' ) < 0 ) { vPattern = vPattern + NumberUtil.BIG_DECIMAL_FORMAT_SUFFIX; } df.applyPattern( vPattern ); return isSetMultiplier( ) ? df.format( bdNum.multiply( BigDecimal.valueOf( getMultiplier( ) ), NumberUtil.DEFAULT_MATHCONTEXT ) ) : df.format( bdNum ); }
Example 2
Source File: JavaNumberFormatSpecifierImpl.java From birt with Eclipse Public License 1.0 | 5 votes |
public String format( double dValue, ULocale lo ) { final DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance( lo ); df.applyPattern( getPattern( ) ); return isSetMultiplier( ) ? df.format( dValue * getMultiplier( ) ) : df.format( dValue ); }