java命名空间java.text类numberformat的类成员方法:
fraction_field定义及介绍
本文导语:
fraction_field
public static final int fraction_field
用于构造 fieldposition 对象的字段常量。表示必须返回格式化数值小数部分的位置。
另请参见:fieldposition,
常量字段值
numberformat
protected numberformat()
唯一的构造方法。(由子类构...
public static final int fraction_field
- 用于构造 fieldposition 对象的字段常量。表示必须返回格式化数值小数部分的位置。
- 另请参见:
fieldposition,
常量字段值
protected numberformat()
- 唯一的构造方法。(由子类构造方法调用,通常是隐式的)。
public stringbuffer format(object number,
stringbuffer toappendto,
fieldposition pos)
- 格式化一个数并将所得文本添加到给定字符串缓冲区。该数可以是
number 的任何子类。
对于能够被转换为 long 类型而不丢失信息的所有整型值,此实现使用 number.longvalue() 提取其数值,包括位长小于 64 的 biginteger 值;使用 number.doublevalue() 提取所有其他类型的值。然后它调用 format(long,java.lang.stringbuffer,java.text.fieldposition) 或 format(double,java.lang.stringbuffer,java.text.fieldposition)。这可能导致丢失数值信息以及 biginteger 和 bigdecimal 值的精度。
- 指定者:
- 类
format 中的 format
- 参数:
number - 要格式化的数toappendto - 要添加格式化文本的 stringbufferpos - 输入时:如果需要,是一个对齐字段。输出时:是对齐字段的偏移量。
- 返回:
- 作为
toappendto 传入的值
- 抛出:
illegalargumentexception - 如果 number 为 null 或不是 number 的实例。
nullpointerexception - 如果 toappendto 或 pos 为 null
arithmeticexception - 如果需要进行舍入但舍入模式设置为 roundingmode.unnecessary- 另请参见:
fieldposition