NumberFormat: getPercentInstance(Locale inLocale) : NumberFormat « java.text « Java by API






NumberFormat: getPercentInstance(Locale inLocale)

  


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

public class Main {
  public static void main(String[] argv) throws Exception {

    Number number = NumberFormat.getPercentInstance(Locale.CANADA).parse("123.45%");
    // 1.2345
    if (number instanceof Long) {
      System.out.println("Long value");
    } else {
      System.out.println("Double value");
    }
  }
}

   
    
  








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: parse(String source)
10.NumberFormat.setMaximumFractionDigits(int newValue)
11.NumberFormat: setMinimumFractionDigits(int newValue)
12.NumberFormat: setMinimumIntegerDigits(int newValue)
13.NumberFormat: setParseIntegerOnly(boolean value)