mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-6391 change format to take double
X-SVN-Rev: 24290
This commit is contained in:
parent
edc5a3b7dd
commit
00877f206b
1 changed files with 5 additions and 4 deletions
|
@ -421,10 +421,10 @@ public class PluralFormat extends UFormat {
|
|||
* <code>PluralFormat</code> object yet, the formatted number will
|
||||
* be returned.
|
||||
* @return the string containing the formatted plural message.
|
||||
* @draft ICU 3.8
|
||||
* @draft ICU 4.0
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public final String format(long number) {
|
||||
public final String format(double number) {
|
||||
// If no pattern was applied, return the formatted number.
|
||||
if (parsedValues == null) {
|
||||
return numberFormat.format(number);
|
||||
|
@ -458,13 +458,14 @@ public class PluralFormat extends UFormat {
|
|||
* @param pos will be ignored by this method.
|
||||
* @return the string buffer passed in as toAppendTo, with formatted text
|
||||
* appended.
|
||||
* @throws IllegalArgumentException if number is not an instance of Number
|
||||
* @draft ICU 3.8
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public StringBuffer format(Object number, StringBuffer toAppendTo,
|
||||
FieldPosition pos) {
|
||||
if (number instanceof Number) {
|
||||
toAppendTo.append(format(((Number) number).longValue()));
|
||||
toAppendTo.append(format(((Number) number).doubleValue()));
|
||||
return toAppendTo;
|
||||
}
|
||||
throw new IllegalArgumentException("'" + number +
|
||||
|
@ -575,7 +576,7 @@ public class PluralFormat extends UFormat {
|
|||
* @param message is the text in which '#' will be replaced.
|
||||
* @return the text with inserted numbers.
|
||||
*/
|
||||
private String insertFormattedNumber(long number, String message) {
|
||||
private String insertFormattedNumber(double number, String message) {
|
||||
if (message == null) {
|
||||
return "";
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue