您的位置:首页 > 数据库 > SQL

关于mssql数据库自动备份-压缩-tftp上传的实现

2012-03-07 15:53 501 查看

// Print out a number using the localized number, integer, currency, 

// and percent format for each locale
Locale[] locales = NumberFormat.getAvailableLocales();
double myNumber = -1234.56;
NumberFormat form;
for (int j=0; j<4; ++j) {
System.out.println("FORMAT");
for (int i = 0; i < locales.length; ++i) {
if (locales[i].getCountry().length() == 0) {
continue; // Skip language-only locales
}
System.out.print(locales[i].getDisplayName());
switch (j) {
case 0:
form = NumberFormat.getInstance(locales[i]); break;
case 1:
form = NumberFormat.getIntegerInstance(locales[i]); break;
case 2:
form = NumberFormat.getCurrencyInstance(locales[i]); break;
default:
form = NumberFormat.getPercentInstance(locales[i]); break;
}
if (form instanceof DecimalFormat) {
System.out.print(": " + ((DecimalFormat) form).toPattern());
}
System.out.print(" -> " + form.format(myNumber));
try {
System.out.println(" -> " + form.parse(form.format(myNumber)));
} catch (ParseException e) {}
}
}


 

 

new java.text.DecimalFormat("#.00").format(sp.area())这样格式化以后就是保留两位小数了

 

DecimalFormat df = new DecimalFormat("0.00");

DecimalFormat df = new DecimalFormat("#.00");

 

没有区别 但如果是0.## 和 0.00的话就可以看出区别了 假设要转换的数字是5 使用0.00转换后结果是5.00 而如果是0.##结果就是5

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: