NumberFormat: setParseIntegerOnly(boolean value) : NumberFormat « java.text « Java by API






NumberFormat: setParseIntegerOnly(boolean value)

 


/*Output: 
 * User's number (US): 1,976.083
 * */


import java.text.NumberFormat;
import java.util.Locale;

public class MainClass {
  public static void main(String args[]) throws Exception {
    NumberFormat numberFormat = NumberFormat.getInstance();
    numberFormat.setParseIntegerOnly(false);
    double usersNumber = 1976.0826;

    numberFormat = NumberFormat.getNumberInstance(Locale.US);
    System.out.println("User's number (US): " + numberFormat.format(usersNumber));
    
  }
}
           
         
  








Related examples in the same category

1.NumberFormat: format(Object obj)
2.NumberFormat.getCurrencyInstance();
3.NumberFormat: getCurrencyInstance(Locale.UK)
4.NumberFormat: getInstance()
5.NumberFormat: getNumberInstance()
6.NumberFormat: getNumberInstance(Locale.FRENCH)
7.NumberFormat: getIntegerInstance(Locale.ITALIAN)
8.NumberFormat: getNumberInstance(Locale inLocale)
9.NumberFormat: getPercentInstance(Locale inLocale)
10.NumberFormat: parse(String source)
11.NumberFormat.setMaximumFractionDigits(int newValue)
12.NumberFormat: setMinimumFractionDigits(int newValue)
13.NumberFormat: setMinimumIntegerDigits(int newValue)