Lines Matching defs:format

67  * <code>NumberFormat</code> helps you to format and parse numbers for any locale.
70 * digits used, or whether the number format is even decimal.
73 * To format a number for the current Locale, use one of the factory
77 * myString = NumberFormat.getInstance().format(myNumber);
81 * more efficient to get the format and use it multiple times so that
88 * output.println(nf.format(myNumber[i]) + "; ");
92 * To format a number for a different Locale, specify it in the
106 * normal number format. Use <code>getIntegerInstance</code> to get an
107 * integer number format. Use <code>getCurrencyInstance</code> to get the
108 * currency number format. And use <code>getPercentInstance</code> to get a
109 * format for displaying percentages. With this format, a fraction like
115 * If you want even more control over the format or parsing,
143 * You can also use forms of the <code>parse</code> and <code>format</code>
153 * you can pass the <code>FieldPosition</code> in your format call, with
173 * It is recommended to create separate format instances for each thread.
174 * If multiple threads access a format concurrently, it must be synchronized
217 * {@link #format(long,java.lang.StringBuffer,java.text.FieldPosition)}
218 * or {@link #format(double,java.lang.StringBuffer,java.text.FieldPosition)}.
221 * @param number the number to format
235 public StringBuffer format(Object number,
243 return format(((Number)number).longValue(), toAppendTo, pos);
245 return format(((Number)number).doubleValue(), toAppendTo, pos);
247 throw new IllegalArgumentException("Cannot format given Object as a Number");
280 * Specialization of format.
283 * @see java.text.Format#format
285 public final String format(double number) {
286 return format(number, new StringBuffer(),
291 * Specialization of format.
294 * @see java.text.Format#format
296 public final String format(long number) {
297 return format(number, new StringBuffer(),
302 * Specialization of format.
305 * @see java.text.Format#format
307 public abstract StringBuffer format(double number,
312 * Specialization of format.
315 * @see java.text.Format#format
317 public abstract StringBuffer format(long number,
357 * Returns true if this format will parse numbers as integers only.
360 * would stop at the "." character. Of course, the exact format accepted
379 * Returns a general-purpose number format for the current default locale.
388 * Returns a general-purpose number format for the specified locale.
397 * Returns a general-purpose number format for the current default locale.
404 * Returns a general-purpose number format for the specified locale.
411 * Returns an integer number format for the current default locale. The
412 * returned number format is configured to round floating point numbers
419 * @return a number format for integer values
427 * Returns an integer number format for the specified locale. The
428 * returned number format is configured to round floating point numbers
435 * @return a number format for integer values
443 * Returns a currency format for the current default locale.
450 * Returns a currency format for the specified locale.
457 * Returns a percentage format for the current default locale.
464 * Returns a percentage format for the specified locale.
471 * Returns a scientific format for the current default locale.
478 * Returns a scientific format for the specified locale.
542 * Returns true if grouping is used in this format. For example, in the
553 * Set whether or not grouping will be used in this format.
669 * Gets the currency used by this number format when formatting
678 * @return the currency used by this number format, or <code>null</code>
679 * @exception UnsupportedOperationException if the number format class
688 * Sets the currency used by this number format when formatting
690 * number of fraction digits used by the number format.
695 * @param currency the new currency to be used by this number format
696 * @exception UnsupportedOperationException if the number format class
769 DecimalFormat format = new DecimalFormat(numberPatterns[entry], symbols);
772 format.setMaximumFractionDigits(0);
773 format.setDecimalSeparatorAlwaysShown(false);
774 format.setParseIntegerOnly(true);
776 format.adjustForCurrencyDefaultFractionDigits();
779 return format;
826 * with the JDK 1.1 version of the stream format.
849 // Constants used by factory methods to specify a style of format.
938 * True if this format will parse numbers as integers only.
997 * <li><b>0</b> (or uninitialized): the JDK 1.1 version of the stream format.
1002 * <li><b>1</b>: the 1.2 version of the stream format. The values of the
1007 * When streaming out a <code>NumberFormat</code>, the most recent format