Home | History | Annotate | Download | only in format

Lines Matching refs:df

99         DecimalFormat df = new DecimalFormat();
101 df.setMinimumFractionDigits(0);
102 df.setMaximumFractionDigits(16);
106 logln("maxFractionDigits = " + df.getMaximumFractionDigits());
107 logln(" format(d) = '" + df.format(d, sBuf1, fp1) + "'");
108 df.setMaximumFractionDigits(17);
111 logln("maxFractionDigits = " + df.getMaximumFractionDigits());
112 df.format(d, sBuf2, fp2);
123 DecimalFormat df = new DecimalFormat("#,##0.0", symbols);
128 df.format(n, buf1, new FieldPosition(0)));
131 df.format(n, buf2, new FieldPosition(0)));
141 DecimalFormat df = new DecimalFormat();
142 df.setMinimumIntegerDigits(0);
146 buffer = df.format(n);
150 buffer = df.format(n);
160 DecimalFormat df = new DecimalFormat();
161 df.setGroupingSize(0);
165 logln(df.format(123, sBuf, fp).toString());
281 DecimalFormat df = new DecimalFormat();
282 Number d = df.parse("123.55456", new ParsePosition(0));
324 DecimalFormat df = new DecimalFormat();
326 df.applyPattern("#.#.#");
327 logln("toPattern() returns \"" + df.toPattern() + "\"");
334 df.applyPattern("#0.0#0#0");
335 logln("toPattern() returns \"" + df.toPattern() + "\"");
347 DecimalFormat df = new DecimalFormat();
348 df.setMinimumFractionDigits(10);
349 df.setGroupingUsed(false);
356 df.format(d, sb, fp);
370 DecimalFormat df = new DecimalFormat();
375 df.setMaximumFractionDigits(i);
379 logln(" formated: " + df.format(d, sb, fp));
391 DecimalFormat df = new DecimalFormat();
394 Number d2 = df.parse(str, new ParsePosition(0));
408 DecimalFormat df = new DecimalFormat();
410 logln("Long.MIN_VALUE : " + df.parse(str, new ParsePosition(0)).toString());
411 df.setMultiplier(100);
412 Number num = df.parse(str, new ParsePosition(0));
465 DecimalFormat df = (DecimalFormat) NumberFormat.getCurrencyInstance(de);
466 DecimalFormatSymbols sym = df.getDecimalFormatSymbols();
468 df.setDecimalFormatSymbols(sym);
475 df.setMinimumIntegerDigits(1);
476 df.setMinimumFractionDigits(2);
477 String str = df.format(1.23);
697 DecimalFormat df = new DecimalFormat("#0.#");
698 roundingTest(df, 12.35, "12.4");
699 roundingTest(df, 12.45, "12.4");
700 roundingTest(df, 12.452,"12.5");
701 roundingTest(df, 12.55, "12.6");
702 roundingTest(df, 12.65, "12.6");
703 roundingTest(df, 12.652,"12.7");
704 roundingTest(df, 12.75, "12.8");
705 roundingTest(df, 12.752,"12.8");
706 roundingTest(df, 12.85, "12.8");
707 roundingTest(df, 12.852,"12.9");
708 roundingTest(df, 12.95, "13");
709 roundingTest(df, 12.952,"13");
712 void roundingTest(DecimalFormat df, double x, String expected)
714 String out = df.format(x);
869 DecimalFormat df = new DecimalFormat("#,##0.###", new
872 Number num = df.parse(text,new ParsePosition(0));
876 num = df.parse(text,new ParsePosition(0));
889 DecimalFormat df = new DecimalFormat(); // Corrected; see 4147706
893 logln("pattern: \"" + df.toPattern() + "\"");
894 df.format(d1, buffer, new FieldPosition(0));
899 df.format(d2, buffer, new FieldPosition(0));
912 DecimalFormat df = new DecimalFormat();
916 logln("pattern: \"" + df.toPattern() + "\"");
917 Number num = df.parse(text, pos1);
921 df = null;
922 df = new DecimalFormat("$###.00");
923 num = df.parse("$", pos2);
948 DecimalFormat df = new DecimalFormat();
953 df.setMultiplier(m);
954 df.setGroupingUsed(false);
956 df.format(n, new StringBuffer(), new FieldPosition(0)));
967 DecimalFormat df = new DecimalFormat();
968 df.setPositivePrefix("+");
969 df.setNegativePrefix("-");
971 logln("pattern: \"" + df.toPattern() + "\"");
973 df.format(d, buffer, new FieldPosition(0));
1287 DecimalFormat df = new DecimalFormat("#,##0.0##");
1288 df.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.ENGLISH));
1291 StringBuffer f1 = df.format(d1, new StringBuffer(), new FieldPosition(0));
1292 StringBuffer f2 = df.format(d2, new StringBuffer(), new FieldPosition(0));
1294 errln(d1 + " x \"" + df.toPattern() + "\" is formatted as \"" + f1 + '"');
1297 errln(d2 + " x \"" + df.toPattern() + "\" is formatted as \"" + f2 + '"');
1385 DecimalFormat df = new DecimalFormat();
1386 df.setParseIntegerOnly(true);
1387 Number n = df.parse("-0.0", new ParsePosition(0));
1413 DecimalFormat df = new DecimalFormat(DATA[i]);
1414 String s = df.toPattern();
1552 DecimalFormat df = (DecimalFormat) nf;
1555 String pat = df.toPattern();
1558 f2.setCurrency(df.getCurrency()); // Currency does not travel with the pattern string
1559 if (!df.equals(f2)) {
1565 pat = df.toLocalizedPattern();
1570 String s2 = df.format(123456);
1573 "\" -> \"" + s2 + '"'+ " in locale "+df.getLocale(ULocale.ACTUAL_LOCALE));
1579 assertEquals("Localized FAIL on posPrefix", df.getPositivePrefix(), f2.getPositivePrefix());
1580 assertEquals("Localized FAIL on posSuffix", df.getPositiveSuffix(), f2.getPositiveSuffix());
1581 assertEquals("Localized FAIL on negPrefix", df.getNegativePrefix(), f2.getNegativePrefix());
1582 assertEquals("Localized FAIL on negSuffix", df.getNegativeSuffix(), f2.getNegativeSuffix());
1583 assertEquals("Localized FAIL on groupingSize", df.getGroupingSize(), f2.getGroupingSize());
1584 assertEquals("Localized FAIL on secondaryGroupingSize", df.getSecondaryGroupingSize(), f2.getSecondaryGroupingSize());
1585 assertEquals("Localized FAIL on minFrac", df.getMinimumFractionDigits(), f2.getMinimumFractionDigits());
1586 assertEquals("Localized FAIL on maxFrac", df.getMaximumFractionDigits(), f2.getMaximumFractionDigits());
1587 assertEquals("Localized FAIL on minInt", df.getMinimumIntegerDigits(), f2.getMinimumIntegerDigits());
1588 assertEquals("Localized FAIL on maxInt", df.getMaximumIntegerDigits(), f2.getMaximumIntegerDigits());
1599 oos.writeObject(df);
1606 if (!df.equals(f2)) {