DecimalFormatSymbols: setCurrencySymbol(String currency)
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
public class MainClass {
public static void main(String[] argv) {
NumberFormat nf = NumberFormat.getInstance();
if (nf instanceof DecimalFormat) {
DecimalFormat df = (DecimalFormat) nf;
DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
dfs.setCurrencySymbol("AD$");
df.setDecimalFormatSymbols(dfs);
df.applyPattern("\u00a4#,###.##");
}
System.out.println(nf.format(1234.56));
}
}
Related examples in the same category