com.ibm.icu.number.FormattedNumber Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of virtdata-lib-realer Show documentation
Show all versions of virtdata-lib-realer Show documentation
With inspiration from other libraries
// © 2017 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License
package com.ibm.icu.number;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.AttributedCharacterIterator;
import java.text.FieldPosition;
import java.util.Arrays;
import com.ibm.icu.impl.number.DecimalQuantity;
import com.ibm.icu.impl.number.MicroProps;
import com.ibm.icu.impl.number.NumberStringBuilder;
import com.ibm.icu.text.PluralRules.IFixedDecimal;
import com.ibm.icu.util.ICUUncheckedIOException;
/**
* The result of a number formatting operation. This class allows the result to be exported in several
* data types, including a String, an AttributedCharacterIterator, and a BigDecimal.
*
* @draft ICU 60
* @provisional This API might change or be removed in a future release.
* @see NumberFormatter
*/
public class FormattedNumber {
NumberStringBuilder nsb;
DecimalQuantity fq;
MicroProps micros;
FormattedNumber(NumberStringBuilder nsb, DecimalQuantity fq, MicroProps micros) {
this.nsb = nsb;
this.fq = fq;
this.micros = micros;
}
/**
* Creates a String representation of the the formatted number.
*
* @return a String containing the localized number.
* @draft ICU 60
* @provisional This API might change or be removed in a future release.
* @see NumberFormatter
*/
@Override
public String toString() {
return nsb.toString();
}
/**
* Append the formatted number to an Appendable, such as a StringBuilder. This may be slightly more
* efficient than creating a String.
*
*