ChoiceFormat ToPattern() Example
Gets the pattern.
ChoiceFormatclass ToPattern() method example. This example shows you how to use ToPattern() method.This method Gets the pattern.
Here is the code:-
/**
* @Program that Gets the pattern.
* ToPattern.java
* Author:-RoseIndia Team
* Date:-18-jun-2008
*/
import java.text.*;
public class ToPattern {
public static void main(String[] args) {
ChoiceFormat cf = new ChoiceFormat("-1#is negative| 0#is zero or fraction | 1#is one");
String s=cf.toPattern();
System.out.println("The pattern is: "+s);
}
} |
Output of the program:-
| The pattern is: -1.0#is negative|0.0#is zero or fraction |1.0#is one |
|