Java Code Examples for java.text.DecimalFormatSymbols#getMinusSign()

The following examples show how to use java.text.DecimalFormatSymbols#getMinusSign() . 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: DecimalStyle.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 2
Source File: DecimalStyle.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 3
Source File: MonetaryFormat.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 4
Source File: DecimalStyle.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 5
Source File: DecimalStyle.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 6
Source File: DecimalStyle.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 7
Source File: DecimalStyle.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 8
Source File: DecimalStyle.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 9
Source File: DecimalStyle.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 10
Source File: DecimalStyle.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 11
Source File: DecimalStyle.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 12
Source File: DecimalStyle.java    From threetenbp with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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);
}
 
Example 13
Source File: DecimalStyle.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 14
Source File: DecimalStyle.java    From desugar_jdk_libs with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 15
Source File: MonetaryFormat.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 16
Source File: DecimalStyle.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
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);
}
 
Example 17
Source File: DecimalStyle.java    From j2objc with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 18
Source File: RangeFormat.java    From sis with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new format for parsing and formatting {@linkplain Range ranges} of
 * the given element type using the given locale. The element type is typically
 * {@code Date.class} or some subclass of {@code Number.class}.
 *
 * @param  locale       the locale for parsing and formatting range components.
 * @param  elementType  the type of range components.
 * @throws IllegalArgumentException if the given type is not recognized by this constructor.
 */
public RangeFormat(final Locale locale, final Class<?> elementType) throws IllegalArgumentException {
    ArgumentChecks.ensureNonNull("locale",      locale);
    ArgumentChecks.ensureNonNull("elementType", elementType);
    this.locale      = locale;
    this.elementType = elementType;
    if (Angle.class.isAssignableFrom(elementType)) {
        elementFormat = AngleFormat.getInstance(locale);
        unitFormat    = null;
    } else if (Number.class.isAssignableFrom(elementType)) {
        elementFormat = NumberFormat.getNumberInstance(locale);
        unitFormat    = new UnitFormat(locale);
    } else if (Date.class.isAssignableFrom(elementType)) {
        elementFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, locale);
        unitFormat    = null;
    } else {
        throw new IllegalArgumentException(Errors.format(Errors.Keys.UnsupportedType_1, elementType));
    }
    final DecimalFormatSymbols ds;
    if (elementFormat instanceof DecimalFormat) {
        ds = ((DecimalFormat) elementFormat).getDecimalFormatSymbols();
    } else {
        ds = DecimalFormatSymbols.getInstance(locale);
    }
    minusSign         = ds.getMinusSign();
    infinity          = ds.getInfinity();
    openSet           = '{';
    openInclusive     = '[';        // Future SIS version may determine those characters from the locale.
    openExclusive     = '(';        // We may also provide an 'applyPattern(String)' method for setting those char.
    openExclusiveAlt  = ']';
    closeSet          = '}';
    closeInclusive    = ']';
    closeExclusive    = ')';
    closeExclusiveAlt = '[';
    separator         = "…";
}
 
Example 19
Source File: DecimalStyle.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 20
Source File: MonetaryFormat.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
}