Java Code Examples for java.text.DecimalFormatSymbols#setDigit()
The following examples show how to use
java.text.DecimalFormatSymbols#setDigit() .
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: NumberFormatter.java From birt with Eclipse Public License 1.0 | 6 votes |
private DecimalFormatSymbols getICUDecimalSymbols( Locale locale ) { DecimalFormatSymbols symbols = new DecimalFormatSymbols( locale ); com.ibm.icu.text.DecimalFormatSymbols icuSymbols = new com.ibm.icu.text.DecimalFormatSymbols( locale ); symbols.setCurrencySymbol( icuSymbols.getCurrencySymbol( ) ); symbols.setDecimalSeparator( icuSymbols.getDecimalSeparator( ) ); symbols.setDigit( icuSymbols.getDigit( ) ); symbols.setGroupingSeparator( icuSymbols.getGroupingSeparator( ) ); symbols.setInfinity( icuSymbols.getInfinity( ) ); symbols.setInternationalCurrencySymbol( icuSymbols .getInternationalCurrencySymbol( ) ); symbols.setMinusSign( icuSymbols.getMinusSign( ) ); symbols.setMonetaryDecimalSeparator( icuSymbols .getMonetaryDecimalSeparator( ) ); symbols.setNaN( icuSymbols.getNaN( ) ); symbols.setPatternSeparator( icuSymbols.getPatternSeparator( ) ); symbols.setPercent( icuSymbols.getPercent( ) ); symbols.setPerMill( icuSymbols.getPerMill( ) ); symbols.setZeroDigit( icuSymbols.getZeroDigit( ) ); return symbols; }
Example 2
Source File: CoreFunctionTest.java From commons-jxpath with Apache License 2.0 | 5 votes |
public void testFormatNumberFunction() { DecimalFormatSymbols symbols = new DecimalFormatSymbols(); symbols.setDigit('D'); context.setDecimalFormatSymbols("test", symbols); assertXPathValue( context, "format-number(123456789, '#.000000000')", "123456789.000000000"); assertXPathValue( context, "format-number(123456789, '#.0')", "123456789.0"); assertXPathValue( context, "format-number(0.123456789, '##%')", "12%"); assertXPathValue( context, "format-number(123456789, '################')", "123456789"); assertXPathValue( context, "format-number(123456789, 'D.0', 'test')", "123456789.0"); assertXPathValue( context, "format-number(123456789, '$DDD,DDD,DDD.DD', 'test')", "$123,456,789"); }
Example 3
Source File: SakaiDecimalFormatSymbolsProvider.java From sakai with Educational Community License v2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public DecimalFormatSymbols getInstance(final Locale locale) throws IllegalArgumentException, NullPointerException { if (locale == null) { throw new NullPointerException("locale:null"); } else if (!SakaiLocaleServiceProviderUtil.isAvailableLocale(locale)) { throw new IllegalArgumentException("locale:" + locale.toString()); } DecimalFormatSymbols symbols = new DecimalFormatSymbols(); symbols.setDecimalSeparator( SakaiLocaleServiceProviderUtil.getChar("DecimalSeparator", locale)); symbols.setDigit( SakaiLocaleServiceProviderUtil.getChar("Digit", locale)); symbols.setExponentSeparator( SakaiLocaleServiceProviderUtil.getString("ExponentSeparator", locale)); symbols.setGroupingSeparator( SakaiLocaleServiceProviderUtil.getChar("GroupingSeparator", locale)); symbols.setInfinity( SakaiLocaleServiceProviderUtil.getString("Infinity", locale)); symbols.setInternationalCurrencySymbol( SakaiLocaleServiceProviderUtil.getString("InternationalCurrencySymbol", locale)); symbols.setCurrencySymbol( SakaiLocaleServiceProviderUtil.getString("CurrencySymbol", locale)); symbols.setMinusSign( SakaiLocaleServiceProviderUtil.getChar("MinusSign", locale)); symbols.setMonetaryDecimalSeparator( SakaiLocaleServiceProviderUtil.getChar("MonetaryDecimalSeparator", locale)); symbols.setNaN( SakaiLocaleServiceProviderUtil.getString("NaN", locale)); symbols.setPatternSeparator( SakaiLocaleServiceProviderUtil.getChar("PatternSeparator", locale)); symbols.setPercent( SakaiLocaleServiceProviderUtil.getChar("Percent", locale)); symbols.setPerMill( SakaiLocaleServiceProviderUtil.getChar("PerMill", locale)); symbols.setZeroDigit( SakaiLocaleServiceProviderUtil.getChar("ZeroDigit", locale)); return symbols; }
Example 4
Source File: SakaiDecimalFormatSymbolsProvider.java From sakai with Educational Community License v2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public DecimalFormatSymbols getInstance(final Locale locale) throws IllegalArgumentException, NullPointerException { if (locale == null) { throw new NullPointerException("locale:null"); } else if (!SakaiLocaleServiceProviderUtil.isAvailableLocale(locale)) { throw new IllegalArgumentException("locale:" + locale.toString()); } DecimalFormatSymbols symbols = new DecimalFormatSymbols(); symbols.setDecimalSeparator( SakaiLocaleServiceProviderUtil.getChar("DecimalSeparator", locale)); symbols.setDigit( SakaiLocaleServiceProviderUtil.getChar("Digit", locale)); symbols.setExponentSeparator( SakaiLocaleServiceProviderUtil.getString("ExponentSeparator", locale)); symbols.setGroupingSeparator( SakaiLocaleServiceProviderUtil.getChar("GroupingSeparator", locale)); symbols.setInfinity( SakaiLocaleServiceProviderUtil.getString("Infinity", locale)); symbols.setInternationalCurrencySymbol( SakaiLocaleServiceProviderUtil.getString("InternationalCurrencySymbol", locale)); symbols.setCurrencySymbol( SakaiLocaleServiceProviderUtil.getString("CurrencySymbol", locale)); symbols.setMinusSign( SakaiLocaleServiceProviderUtil.getChar("MinusSign", locale)); symbols.setMonetaryDecimalSeparator( SakaiLocaleServiceProviderUtil.getChar("MonetaryDecimalSeparator", locale)); symbols.setNaN( SakaiLocaleServiceProviderUtil.getString("NaN", locale)); symbols.setPatternSeparator( SakaiLocaleServiceProviderUtil.getChar("PatternSeparator", locale)); symbols.setPercent( SakaiLocaleServiceProviderUtil.getChar("Percent", locale)); symbols.setPerMill( SakaiLocaleServiceProviderUtil.getChar("PerMill", locale)); symbols.setZeroDigit( SakaiLocaleServiceProviderUtil.getChar("ZeroDigit", locale)); return symbols; }