本文整理汇总了Java中java.text.DecimalFormatSymbols.getZeroDigit方法的典型用法代码示例。如果您正苦于以下问题:Java DecimalFormatSymbols.getZeroDigit方法的具体用法?Java DecimalFormatSymbols.getZeroDigit怎么用?Java DecimalFormatSymbols.getZeroDigit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.text.DecimalFormatSymbols
的用法示例。
在下文中一共展示了DecimalFormatSymbols.getZeroDigit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LocalizeWriter
import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
public LocalizeWriter(Writer out, Locale locale, boolean localizeDigits, boolean isUpperCase)
{
super(out);
this.locale = locale;
this.localizeDigits = localizeDigits;
this.isUpperCase = isUpperCase;
if (locale != null)
{
DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(locale);
this.zero = decimalFormatSymbols.getZeroDigit();
this.decimalSeparator = decimalFormatSymbols.getDecimalSeparator();
}
else
{
this.zero = '0';
this.decimalSeparator = '.';
}
}
示例2: withLocale
import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
/**
* 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);
}
示例3: create
import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
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);
}
示例4: getZero
import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
private static char getZero(Locale l) {
if ((l != null) && !l.equals(Locale.US)) {
DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(l);
return dfs.getZeroDigit();
} else {
return '0';
}
}
示例5: checkDigit
import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
private void checkDigit(Locale loc, Character expected) {
DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(loc);
Character zero = dfs.getZeroDigit();
assertEquals("Wrong digit zero char", expected, zero);
}