我在做一个报表系统,需要将报表保存为csv格式。但是各个地区的人的csv的分隔符是不一样的,在控制面板“Regional and language options”中的list separator 定义了这个分隔符。 但是似乎我用java.text.DecimalFormatSymbols找不到相应的方法取道它的值。 各位有没有方法来取这个值啊,请不吝赐教。
The resource bundle that you were using has been moved into a "sun" package, and it is not recommended that you use them. However there is an easier way that will work in any JDK, which is to use the "java.text.DecimalFormatSymbols" class. There is a default constructor which will use the current locale, and a constructor that takes a locale. Once you have the instance you can call methods to get the currency symbol, decimal separator, grouping separator, etc. Look at the JavaDoc for the "java.text.DecimalFormatSymbols" class. code: import java.text.*; ... DecimalFormatSymbols dfs = new DecimalFormatSymbols(); System.out.println("Currency: " + dfs.getCurrencySymbol()); System.out.println(" Decimal: " + dfs.getDecimalSeparator()); System.out.println("Grouping: " + dfs.getGroupingSeparator()); System.out.println(" Percent: " + dfs.getPercent());Cheers!
楼主【ahuango】截止到2008-07-20 09:43:49的历史汇总数据(不包括此帖):
发帖的总数量:1 发帖的总分数:0 每贴平均分数:0
回帖的总数量:1 得分贴总数量:0 回帖的得分率:0%
结贴的总数量:1 结贴的总分数:0
无满意结贴数:1 无满意结贴分:20
未结的帖子数:0 未结的总分数:0
结贴的百分比:100.00% 结分的百分比:---------------------
无满意结贴率:100.00% 无满意结分率:---------------------
敬礼!
import java.text.*;
...
DecimalFormatSymbols dfs = new DecimalFormatSymbols();
System.out.println("Currency: " + dfs.getCurrencySymbol());
System.out.println(" Decimal: " + dfs.getDecimalSeparator());
System.out.println("Grouping: " + dfs.getGroupingSeparator());
System.out.println(" Percent: " + dfs.getPercent());Cheers!