Java.util.Formatter.format(Locale l,String format,Object args) Method ...
JAVA.UTIL.FORMATTER.FORMAT METHOD
Copyright ?
Description
The java.util.Formatter.formatLocalel, Stringformat, Object. . . args method writes a formatted string to this object's destination using the specified locale, format string, and arguments.
Declaration
Following is the declaration for java.util.Formatter.format method
public Formatter format(Locale l,String format,Object... args)
Parameters
l -- The locale to apply during formatting. If l is null then no localization is applied. This does not change this object's locale that was set during construction. format -- A format string as described in Format string syntax. args -- Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The maximum number of arguments is limited by the maximum dimension of a Java array as defined by the Java Virtual Machine Specification
Return Value
This method returns this formatter
Exception
FormatterClosedException -- If this formatter has been closed by invoking its close method IllegalFormatException -- If a format string contains an illegal syntax, a format specifier that is incompatible with the given arguments, insufficient arguments given the format string, or other illegal conditions.
Example
The following example shows the usage of java.util.Formatter.flush method.
package com.tutorialspoint;
import java.util.Formatter; import java.util.Locale;
public class FormatterDemo {
public static void main(String[] args) {
// create a new formatter StringBuffer buffer = new StringBuffer(); Formatter formatter = new Formatter(buffer, Locale.US);
// format a new string String name = "World"; formatter.format(Locale.US,"Hello %s !", name);
// print the formatted string with specified locale System.out.println("" + formatter + " " + formatter.locale());
} }
Let us compile and run the above program, this will produce the following result:
Hello World ! en_US
Loading [MathJax]/jax/output/HTML-CSS/jax.js
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- a type system for format strings university of washington
- summary of basic java syntax
- java string format 0
- string java format example programs pdf
- java printf method quick reference colorado state university
- java string format 8s
- java format string with parameters
- java syntax examples
- format string syntax java example
- method example
Related searches
- java string format time
- javascript string format number
- string to java util date
- java string format specifiers
- datetime string format milliseconds python
- pandas format object to string
- object vs method vs class
- convert string to object js
- c string format double
- f string format in python
- convert string to object javascript
- python string format integer