Here you can find the source of formatDecimal(double value, String mask)
Parameter | Description |
---|---|
value | a parameter |
mask | a parameter |
public static String formatDecimal(double value, String mask)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; public class Main { /**// w w w . ja v a 2s .c om * Formata um decimal, de acordo com a mascara. * @param value * @param mask * @return */ public static String formatDecimal(double value, String mask) { DecimalFormatSymbols dfs = new DecimalFormatSymbols(); dfs.setDecimalSeparator(','); dfs.setGroupingSeparator('.'); DecimalFormat df = new DecimalFormat(mask, dfs); return df.format(value); } }