NumberFormat SetParseIntegerOnly() Example
Sets whether or not numbers should be parsed as integers only.
NumberFormatclass SetParseIntegerOnly() method example. This example shows you how to use SetParseIntegerOnly() method.This method Sets whether or not numbers should be parsed as integers only.
Here is the code:-
/**
* @Program that Sets whether or not numbers should be parsed as integers only.
* SetParseIntegerOnly.java
* Author:-RoseIndia Team
* Date:-17-Jun-2008
*/
import java.text.*;
import java.util.*;
public class SetParseIntegerOnly {
public static void main(String[] args) {
//Creating Numberformat instance
NumberFormat nf = NumberFormat.getInstance();
System.out.println("Parse numbers as integers only: "+nf.isParseIntegerOnly());
nf.setParseIntegerOnly(true);
System.out.println("Parse numbers as integers only: "+nf.isParseIntegerOnly());
}
} |
Output of the program:-
Parse numbers as integers only: false
Parse numbers as integers only: true |
|