private String addNegativeSign(String unsignedNumeral) { String negativePrefix = ""; String negativeSuffix = ""; if (!decimalFormat.getNegativePrefix().isEmpty()) { negativePrefix = "\\Q" + decimalFormat.getNegativePrefix() + "\\E"; } if (!decimalFormat.getNegativeSuffix().isEmpty()) { negativeSuffix = "\\Q" + decimalFormat.getNegativeSuffix() + "\\E"; } return negativePrefix + unsignedNumeral + negativeSuffix; }
private boolean removeLocaleSign(StringBuilder tokenBuilder) { String positivePrefix = decimalFormat.getPositivePrefix(); String positiveSuffix = decimalFormat.getPositiveSuffix(); String negativePrefix = decimalFormat.getNegativePrefix(); String negativeSuffix = decimalFormat.getNegativeSuffix();
/** * Returns the negative prefix. * * <p>Examples: -123, ($123) (with negative suffix), sFr-123 * * @return the prefix * @stable ICU 2.0 */ public String getNegativePrefix() { return ((java.text.DecimalFormat)numberFormat).getNegativePrefix(); }
/** * Returns the negative prefix. * * <p>Examples: -123, ($123) (with negative suffix), sFr-123 * * @return the prefix * @stable ICU 2.0 */ public String getNegativePrefix() { return ((java.text.DecimalFormat)numberFormat).getNegativePrefix(); }
private String addNegativeSign(String unsignedNumeral) { String negativePrefix = ""; String negativeSuffix = ""; if (!decimalFormat.getNegativePrefix().isEmpty()) { negativePrefix = "\\Q" + decimalFormat.getNegativePrefix() + "\\E"; } if (!decimalFormat.getNegativeSuffix().isEmpty()) { negativeSuffix = "\\Q" + decimalFormat.getNegativeSuffix() + "\\E"; } return negativePrefix + unsignedNumeral + negativeSuffix; }
private String addNegativeSign(String unsignedNumeral) { String negativePrefix = ""; String negativeSuffix = ""; if (!decimalFormat.getNegativePrefix().isEmpty()) { negativePrefix = "\\Q" + decimalFormat.getNegativePrefix() + "\\E"; } if (!decimalFormat.getNegativeSuffix().isEmpty()) { negativeSuffix = "\\Q" + decimalFormat.getNegativeSuffix() + "\\E"; } return negativePrefix + unsignedNumeral + negativeSuffix; }
private String addNegativeSign(String unsignedNumeral) { String negativePrefix = ""; String negativeSuffix = ""; if (!decimalFormat.getNegativePrefix().isEmpty()) { negativePrefix = "\\Q" + decimalFormat.getNegativePrefix() + "\\E"; } if (!decimalFormat.getNegativeSuffix().isEmpty()) { negativeSuffix = "\\Q" + decimalFormat.getNegativeSuffix() + "\\E"; } return negativePrefix + unsignedNumeral + negativeSuffix; }
private String addNegativeSign(String unsignedNumeral) { String negativePrefix = ""; String negativeSuffix = ""; if (!decimalFormat.getNegativePrefix().isEmpty()) { negativePrefix = "\\Q" + decimalFormat.getNegativePrefix() + "\\E"; } if (!decimalFormat.getNegativeSuffix().isEmpty()) { negativeSuffix = "\\Q" + decimalFormat.getNegativeSuffix() + "\\E"; } return negativePrefix + unsignedNumeral + negativeSuffix; }
private String addNegativeSign(String unsignedNumeral) { String negativePrefix = ""; String negativeSuffix = ""; if (!decimalFormat.getNegativePrefix().isEmpty()) { negativePrefix = "\\Q" + decimalFormat.getNegativePrefix() + "\\E"; } if (!decimalFormat.getNegativeSuffix().isEmpty()) { negativeSuffix = "\\Q" + decimalFormat.getNegativeSuffix() + "\\E"; } return negativePrefix + unsignedNumeral + negativeSuffix; }
private String addNegativeSign(String unsignedNumeral) { String negativePrefix = ""; String negativeSuffix = ""; if (!decimalFormat.getNegativePrefix().isEmpty()) { negativePrefix = "\\Q" + decimalFormat.getNegativePrefix() + "\\E"; } if (!decimalFormat.getNegativeSuffix().isEmpty()) { negativeSuffix = "\\Q" + decimalFormat.getNegativeSuffix() + "\\E"; } return negativePrefix + unsignedNumeral + negativeSuffix; }
private String addNegativeSign(String unsignedNumeral) { String negativePrefix = ""; String negativeSuffix = ""; if (!decimalFormat.getNegativePrefix().isEmpty()) { negativePrefix = "\\Q" + decimalFormat.getNegativePrefix() + "\\E"; } if (!decimalFormat.getNegativeSuffix().isEmpty()) { negativeSuffix = "\\Q" + decimalFormat.getNegativeSuffix() + "\\E"; } return negativePrefix + unsignedNumeral + negativeSuffix; }
String LocaleCountry = new Locale("en").getDefault().getCountry(); String LocaleLanguage = new Locale("en").getDefault().getLanguage(); String LocaleCurrency = new DecimalFormatSymbols().getCurrency().toString(); String LocaleShortDateTimePattern =new SimpleDateFormat().toPattern(); char LocaleDecimalSeparator = new DecimalFormatSymbols().getDecimalSeparator(); char LocaleThousandSeparator = new DecimalFormatSymbols().getGroupingSeparator(); String LocaleThousandGrouping = String.format("%d;0", new DecimalFormat().getMaximumFractionDigits()); String LocaleNegativePrefix = new DecimalFormat().getNegativePrefix(); String LocaleNegativeSuffix =new DecimalFormat().getNegativeSuffix(); String Operator = Utils.getQwnername(context);
private boolean removeLocaleSign(StringBuilder tokenBuilder) { String positivePrefix = decimalFormat.getPositivePrefix(); String positiveSuffix = decimalFormat.getPositiveSuffix(); String negativePrefix = decimalFormat.getNegativePrefix(); String negativeSuffix = decimalFormat.getNegativeSuffix();
private boolean removeLocaleSign(StringBuilder tokenBuilder) { String positivePrefix = decimalFormat.getPositivePrefix(); String positiveSuffix = decimalFormat.getPositiveSuffix(); String negativePrefix = decimalFormat.getNegativePrefix(); String negativeSuffix = decimalFormat.getNegativeSuffix();
private boolean removeLocaleSign(StringBuilder tokenBuilder) { String positivePrefix = decimalFormat.getPositivePrefix(); String positiveSuffix = decimalFormat.getPositiveSuffix(); String negativePrefix = decimalFormat.getNegativePrefix(); String negativeSuffix = decimalFormat.getNegativeSuffix();
private boolean removeLocaleSign(StringBuilder tokenBuilder) { String positivePrefix = decimalFormat.getPositivePrefix(); String positiveSuffix = decimalFormat.getPositiveSuffix(); String negativePrefix = decimalFormat.getNegativePrefix(); String negativeSuffix = decimalFormat.getNegativeSuffix();
private boolean removeLocaleSign(StringBuilder tokenBuilder) { String positivePrefix = decimalFormat.getPositivePrefix(); String positiveSuffix = decimalFormat.getPositiveSuffix(); String negativePrefix = decimalFormat.getNegativePrefix(); String negativeSuffix = decimalFormat.getNegativeSuffix();
/** * if a format, like the currency (see {@link DecimalFormat#getNegativeSuffix()}, needs a number suffix, we have to * give it to the parsing process. * * @param format format to ask * @return empty or filled suffix */ protected static String getParsingSuffix(Format format, String txt) { if (format instanceof GenericParser) { format = ((GenericParser) format).getParsingFormat(); } //TODO: its a workaround to handle the currency format. use the positive/negative prefix and suffix if (format instanceof DecimalFormat) { final StringBuffer s = new StringBuffer(); final DecimalFormat decFormat = (DecimalFormat) format; final String prefix = decFormat.getNegativePrefix(); if (txt.equals(prefix)) { s.append("0"); } final String suffix = decFormat.getNegativeSuffix(); if (!txt.contains(suffix)) { return s.append(suffix).toString(); } else { return s.toString(); } } else { return ""; } }
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); }
@Override protected NumberSymbols createObject(Locale locale, NumberType numberType, Object... params) throws Exception { DecimalFormat df = null; switch (numberType) { case INTEGER: df = (DecimalFormat) DecimalFormat.getIntegerInstance(locale); break; case PERCENT: df = (DecimalFormat) DecimalFormat.getPercentInstance(locale); break; case DECIMAL: default: df = (DecimalFormat) DecimalFormat.getNumberInstance(locale); break; } DecimalFormatSymbols dfs = df.getDecimalFormatSymbols(); return new NumberSymbols(numberType, df.getNegativePrefix(), df.getNegativeSuffix(), df.getPositivePrefix(), df.getPositiveSuffix(), df.getGroupingSize(), dfs.getGroupingSeparator(), dfs.getDecimalSeparator()); } };