DecimalFormat ToPattern() Example
Synthesizes a pattern string that represents the current state of this Format object.
DecimalFormatclass ToPattern() method example. This example shows you how to use ToPattern() method.This method Synthesizes a pattern string that represents the current state of this Format object.
Here is the code:-
/**
* @Program that Synthesizes a pattern string that represents the current state
* of this Format object.
* ToPattern.java
* Author:-RoseIndia Team
* Date:-13-Jun-2008
*/
import java.text.*;
public class ToPattern {
public static void main(String[] args) {
// Creates a DecimalFormat object
DecimalFormat d = new DecimalFormat();
//Apply the given pattern to this Format object.
d.applyPattern("#,#00.0#");
//Synthesizes a pattern string
String s = d.toPattern();
System.out.println("The current state of this Format object is: " + s);
}
} |
Output of the Program
| The current state of this Format object is: #,#00.0# |
|