/** * Sets the positive suffix. * * <p>Example: 123% * @param newValue the suffix * @stable ICU 2.0 */ public void setPositiveSuffix(String newValue) { ((java.text.DecimalFormat)numberFormat).setPositiveSuffix(newValue); }
/** * Sets the positive suffix. * * <p>Example: 123% * @param newValue the suffix * @stable ICU 2.0 */ public void setPositiveSuffix(String newValue) { ((java.text.DecimalFormat)numberFormat).setPositiveSuffix(newValue); }
pad[i] = ' '; df.setPositiveSuffix(new String(pad));
public static String numberToCurrencyString(Number damount, boolean bCurrencySign, EscapeFunction f) { LanguageSetting s = languageProvider.vend(); String rv; DecimalFormat d = (DecimalFormat) NumberFormat.getCurrencyInstance(s.locale); if (damount.doubleValue() < 0) { if (d.getNegativePrefix().contains("(")) d.setNegativePrefix(d.getNegativePrefix().replace("(", "-")); if (d.getNegativeSuffix().contains(")")) d.setNegativeSuffix(d.getNegativeSuffix().replace(")", "")); } if (!bCurrencySign) { d.setPositivePrefix(""); d.setPositiveSuffix(""); d.setNegativePrefix("-"); d.setNegativeSuffix(""); } rv = d.format(damount.doubleValue()); rv.replace((char) 160, ' '); return f.escape(rv); }
amount = amount.replace(d.getPositiveSuffix(), "").trim(); d.setPositivePrefix(""); d.setPositiveSuffix(""); d.setNegativePrefix("-"); d.setNegativeSuffix("");
df.setPositiveSuffix(node.getSuffix() + df.getPositiveSuffix()); df.setNegativeSuffix(node.getSuffix() + df.getNegativeSuffix()); buf.append(' '); df.setPositiveSuffix(buf.toString()); } else if (posSufLen > negSufLen) { StringBuilder buf = new StringBuilder(df.getNegativeSuffix());
@Override public void setPercent(boolean b) { DecimalFormat percentDF = BEANS.get(NumberFormatProvider.class).getPercentInstance(NlsLocale.get()); DecimalFormat format = getFormat(); if (b) { format.setPositiveSuffix(percentDF.getPositiveSuffix()); format.setNegativeSuffix(percentDF.getNegativeSuffix()); } else { if (isPercent()) { format.setPositiveSuffix(""); format.setNegativeSuffix(""); } } setFormat(format); }
@Override public void setPercent(boolean b) { try { DecimalFormat percentDF = BEANS.get(NumberFormatProvider.class).getPercentInstance(NlsLocale.get()); DecimalFormat format = getFormat(); if (b) { format.setPositiveSuffix(percentDF.getPositiveSuffix()); format.setNegativeSuffix(percentDF.getNegativeSuffix()); } else { if (isPercent()) { format.setPositiveSuffix(""); format.setNegativeSuffix(""); } } setFormat(format); } finally { setFieldChanging(false); } }