use of android.icu.text.ScientificNumberFormatter in project j2objc by google.
the class ScientificNumberFormatterTest method TestFarsi.
@Test
public void TestFarsi() {
ScientificNumberFormatter fmt = ScientificNumberFormatter.getMarkupInstance(new ULocale("fa"), "<sup>", "</sup>");
assertEquals("", "۱٫۲۳۴۵۶×۱۰<sup>−۷۸</sup>", fmt.format(1.23456e-78));
}
use of android.icu.text.ScientificNumberFormatter in project j2objc by google.
the class ScientificNumberFormatterTest method TestBasic.
@Test
public void TestBasic() {
ScientificNumberFormatter markup = ScientificNumberFormatter.getMarkupInstance(ULocale.ENGLISH, "<sup>", "</sup>");
ScientificNumberFormatter superscript = ScientificNumberFormatter.getSuperscriptInstance(ULocale.ENGLISH);
assertEquals("toMarkupExponentDigits", "1.23456×10<sup>-78</sup>", markup.format(1.23456e-78));
assertEquals("toSuperscriptExponentDigits", "1.23456×10⁻⁷⁸", superscript.format(1.23456e-78));
}
use of android.icu.text.ScientificNumberFormatter in project j2objc by google.
the class ScientificNumberFormatterTest method TestFixedDecimalSuperscript.
@Test
public void TestFixedDecimalSuperscript() {
DecimalFormat decfmt = (DecimalFormat) NumberFormat.getInstance(ULocale.ENGLISH);
ScientificNumberFormatter fmt = ScientificNumberFormatter.getSuperscriptInstance(decfmt);
assertEquals("", "123,456", fmt.format(123456.0));
}
use of android.icu.text.ScientificNumberFormatter in project j2objc by google.
the class ScientificNumberFormatterTest method TestPlusSignInExponentMarkup.
@Test
public void TestPlusSignInExponentMarkup() {
DecimalFormat decfmt = (DecimalFormat) NumberFormat.getScientificInstance(ULocale.ENGLISH);
decfmt.applyPattern("0.00E+0");
ScientificNumberFormatter fmt = ScientificNumberFormatter.getMarkupInstance(decfmt, "<sup>", "</sup>");
assertEquals("", "6.02×10<sup>+23</sup>", fmt.format(6.02e23));
}
use of android.icu.text.ScientificNumberFormatter in project j2objc by google.
the class ScientificNumberFormatterTest method TestPlusSignInExponentSuperscript.
@Test
public void TestPlusSignInExponentSuperscript() {
DecimalFormat decfmt = (DecimalFormat) NumberFormat.getScientificInstance(ULocale.ENGLISH);
decfmt.applyPattern("0.00E+0");
ScientificNumberFormatter fmt = ScientificNumberFormatter.getSuperscriptInstance(decfmt);
assertEquals("", "6.02×10⁺²³", fmt.format(6.02e23));
}
Aggregations