NumberFormat Parse() Example
Parses text from the beginning of the given string to produce a number
NumberFormatclass Parse() method example. This example shows you how to use Parse() method.This method
Parses text from the beginning of the given string to produce a number
Here is the code:-
/**
* @Program that Parses text from the beginning of the given string to produce
* a number
* Parse.java
* Author:-RoseIndia Team
* Date:-17-Jun-2008
*/
import java.text.*;
import java.util.*;
public class Parse {
public static void main(String[] args) throws ParseException {
//Creating Numberformat instance
NumberFormat nf = NumberFormat.getInstance();
Number n=nf.parse("123456");
System.out.println("Given string was: "+n);
}
} |
|