/** * Get the "minus-sign" attribute. * minus-sign specifies the character used as the default minus sign; the * default value is the hyphen-minus character (-, #x2D). * * @return Character to use as minus sign */ public char getMinusSign() { return m_dfs.getMinusSign(); }
/** * Get the "minus-sign" attribute. * minus-sign specifies the character used as the default minus sign; the * default value is the hyphen-minus character (-, #x2D). * * @return Character to use as minus sign */ public char getMinusSign() { return m_dfs.getMinusSign(); }
public static boolean isStringNumeric( String str ) { DecimalFormatSymbols currentLocaleSymbols = DecimalFormatSymbols.getInstance(); char localeMinusSign = currentLocaleSymbols.getMinusSign(); if ( !Character.isDigit( str.charAt( 0 ) ) && str.charAt( 0 ) != localeMinusSign ) return false; boolean isDecimalSeparatorFound = false; char localeDecimalSeparator = currentLocaleSymbols.getDecimalSeparator(); for ( char c : str.substring( 1 ).toCharArray() ) { if ( !Character.isDigit( c ) ) { if ( c == localeDecimalSeparator && !isDecimalSeparatorFound ) { isDecimalSeparatorFound = true; continue; } return false; } } return true; }
DecimalFormat df = (DecimalFormat) numberFormat; char lastChar = string.charAt(position.getIndex() - 1); char minusSign = df.getDecimalFormatSymbols().getMinusSign(); if (lastChar == minusSign) {
public NativeDecimalFormat(String pattern, DecimalFormatSymbols dfs) { try { this.address = open(pattern, dfs.getCurrencySymbol(), dfs.getDecimalSeparator(), dfs.getDigit(), dfs.getExponentSeparator(), dfs.getGroupingSeparator(), dfs.getInfinity(), dfs.getInternationalCurrencySymbol(), dfs.getMinusSign(), dfs.getMonetaryDecimalSeparator(), dfs.getNaN(), dfs.getPatternSeparator(), dfs.getPercent(), dfs.getPerMill(), dfs.getZeroDigit()); this.lastPattern = pattern; } catch (NullPointerException npe) { throw npe; } catch (RuntimeException re) { throw new IllegalArgumentException("syntax error: " + re.getMessage() + ": " + pattern); } }
/** * Copies the DecimalFormatSymbols settings into our native peer in bulk. */ public void setDecimalFormatSymbols(final DecimalFormatSymbols dfs) { setDecimalFormatSymbols(this.address, dfs.getCurrencySymbol(), dfs.getDecimalSeparator(), dfs.getDigit(), dfs.getExponentSeparator(), dfs.getGroupingSeparator(), dfs.getInfinity(), dfs.getInternationalCurrencySymbol(), dfs.getMinusSign(), dfs.getMonetaryDecimalSeparator(), dfs.getNaN(), dfs.getPatternSeparator(), dfs.getPercent(), dfs.getPerMill(), dfs.getZeroDigit()); }
private void writeObject(ObjectOutputStream stream) throws IOException { ObjectOutputStream.PutField fields = stream.putFields(); fields.put("currencySymbol", currencySymbol); fields.put("decimalSeparator", getDecimalSeparator()); fields.put("digit", getDigit()); fields.put("exponential", exponentSeparator.charAt(0)); fields.put("exponentialSeparator", exponentSeparator); fields.put("groupingSeparator", getGroupingSeparator()); fields.put("infinity", infinity); fields.put("intlCurrencySymbol", intlCurrencySymbol); fields.put("minusSign", getMinusSign()); fields.put("monetarySeparator", getMonetaryDecimalSeparator()); fields.put("NaN", NaN); fields.put("patternSeparator", getPatternSeparator()); fields.put("percent", getPercent()); fields.put("perMill", getPerMill()); fields.put("serialVersionOnStream", 3); fields.put("zeroDigit", getZeroDigit()); fields.put("locale", locale); stream.writeFields(); }
DecimalFormat dformat = (DecimalFormat)format; dformat.setNegativePrefix( "" + dformat.getDecimalFormatSymbols().getMinusSign()); dformat.setNegativeSuffix("");
DecimalFormat dformat = (DecimalFormat)format; dformat.setNegativePrefix( "" + dformat.getDecimalFormatSymbols().getMinusSign()); dformat.setNegativeSuffix( "" + dformat.getDecimalFormatSymbols().getPercent());
/** * Return the character used to represent minus sign. If no explicit * negative format is specified, one is formed by prefixing * minusSign to the positive format. * @return the minus sign character * @stable ICU 2.0 */ public char getMinusSign() { return dfs.getMinusSign(); }
/** * Get the "minus-sign" attribute. * minus-sign specifies the character used as the default minus sign; the * default value is the hyphen-minus character (-, #x2D). * * @return Character to use as minus sign */ public char getMinusSign() { return m_dfs.getMinusSign(); }
/** * Get the "minus-sign" attribute. * minus-sign specifies the character used as the default minus sign; the * default value is the hyphen-minus character (-, #x2D). * * @return Character to use as minus sign */ public char getMinusSign() { return m_dfs.getMinusSign(); }
FloatUtil(StringBuilder result, FormatToken formatToken, DecimalFormat decimalFormat, Object argument) { this.result = result; this.formatToken = formatToken; this.decimalFormat = decimalFormat; this.argument = argument; this.minusSign = decimalFormat.getDecimalFormatSymbols() .getMinusSign(); }
protected JSONObject decimalFormatSymbolsToJson(DecimalFormatSymbols symbols) { JSONObject json = new JSONObject(); json.put("decimalSeparator", String.valueOf(symbols.getDecimalSeparator())); json.put("groupingSeparator", String.valueOf(symbols.getGroupingSeparator())); json.put("minusSign", String.valueOf(symbols.getMinusSign())); return json; }
private static DecimalStyle create(Locale locale) { DecimalFormatSymbols oldSymbols = DecimalFormatSymbols.getInstance(locale); char zeroDigit = oldSymbols.getZeroDigit(); char positiveSign = '+'; char negativeSign = oldSymbols.getMinusSign(); char decimalSeparator = oldSymbols.getDecimalSeparator(); if (zeroDigit == '0' && negativeSign == '-' && decimalSeparator == '.') { return STANDARD; } return new DecimalStyle(zeroDigit, positiveSign, negativeSign, decimalSeparator); }
private static DecimalStyle create(Locale locale) { DecimalFormatSymbols oldSymbols = DecimalFormatSymbols.getInstance(locale); char zeroDigit = oldSymbols.getZeroDigit(); char positiveSign = '+'; char negativeSign = oldSymbols.getMinusSign(); char decimalSeparator = oldSymbols.getDecimalSeparator(); if (zeroDigit == '0' && negativeSign == '-' && decimalSeparator == '.') { return STANDARD; } return new DecimalStyle(zeroDigit, positiveSign, negativeSign, decimalSeparator); }
/** * Configure this instance with values from a {@link Locale}. */ public MonetaryFormat withLocale(Locale locale) { DecimalFormatSymbols dfs = new DecimalFormatSymbols(locale); char negativeSign = dfs.getMinusSign(); char zeroDigit = dfs.getZeroDigit(); char decimalMark = dfs.getMonetaryDecimalSeparator(); return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups, shift, roundingMode, codes, codeSeparator, codePrefixed); }
private static DecimalStyle create(Locale locale) { DecimalFormatSymbols oldSymbols = DecimalFormatSymbols.getInstance(locale); char zeroDigit = oldSymbols.getZeroDigit(); char positiveSign = '+'; char negativeSign = oldSymbols.getMinusSign(); char decimalSeparator = oldSymbols.getDecimalSeparator(); if (zeroDigit == '0' && negativeSign == '-' && decimalSeparator == '.') { return STANDARD; } return new DecimalStyle(zeroDigit, positiveSign, negativeSign, decimalSeparator); }
/** * Copies the DecimalFormatSymbols settings into our native peer in bulk. */ public void setDecimalFormatSymbols(final DecimalFormatSymbols dfs) { setDecimalFormatSymbols(this.address, dfs.getCurrencySymbol(), dfs.getDecimalSeparator(), dfs.getDigit(), dfs.getExponentSeparator(), dfs.getGroupingSeparator(), dfs.getInfinity(), dfs.getInternationalCurrencySymbol(), dfs.getMinusSign(), dfs.getMonetaryDecimalSeparator(), dfs.getNaN(), dfs.getPatternSeparator(), dfs.getPercent(), dfs.getPerMill(), dfs.getZeroDigit()); }
/** * Copies the DecimalFormatSymbols settings into our native peer in bulk. */ public void setDecimalFormatSymbols(final DecimalFormatSymbols dfs) { setDecimalFormatSymbols(this.address, dfs.getCurrencySymbol(), dfs.getDecimalSeparator(), dfs.getDigit(), dfs.getExponentSeparator(), dfs.getGroupingSeparator(), dfs.getInfinity(), dfs.getInternationalCurrencySymbol(), dfs.getMinusSign(), dfs.getMonetaryDecimalSeparator(), dfs.getNaN(), dfs.getPatternSeparator(), dfs.getPercent(), dfs.getPerMill(), dfs.getZeroDigit()); }