Code example for DecimalFormat

Methods: setDecimalFormatSymbolsparse

0
 
    public static int parseGetal(String getal) throws ParseException {
        DecimalFormatSymbols dfs = new DecimalFormatSymbols();
        dfs.setGroupingSeparator('.');
        dfs.setDecimalSeparator(',');
        DecimalFormat decimalFormat = new DecimalFormat();
        decimalFormat.setDecimalFormatSymbols(dfs);
        Number number = decimalFormat.parse(getal);
        return number.intValue();
    } 
 
    public static int numberOfDaysPreviousMonth() { 
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.MONTH, -1);
        return numberOfDaysInMonth(cal);
    } 
 
    public static int numberOfDaysThisMonth() { 
        Calendar cal = Calendar.getInstance();
        return numberOfDaysInMonth(cal);
Stop searching for code, let great code find you!  Add Codota to your java IDE