Hi, all, I want to get the List separator of the local system in my applet, and I can get it using this: ResourceBundle rb = ResourceBundle.getBundle ("java.text.resources.localeElements",Locale.getDefault()); String elmArr = rb.getStringArr("NumberElements"); char listSeparator = elmArr.charAt(0); it works good when I use MS JVM or sun plugin 1.3, but when I use sun plugin1.4 to test it, it throw exception, because java.text.resources.localeElements doesn't exist in jdk1.4. So my question is how to get this List separator in both case(support jdk1.1 to jdk1.4)? Thanks anvance
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.
Cheers! [ September 04, 2003: Message edited by: Wayne L Johnson ]
Joined: Sep 04, 2003
Hi,Wayne, Thanks for reply, but the problem is when I use DecimalFormatSymbols like below: DecimalFormatSymbols tempdfs = new DecimalFormatSymbols (Locale.getDefault()); char tempDS = tempdfs.getDecimalSeparator(); char tempGS = tempdfs.getGroupingSeparator(); char tempLS = tempdfs.getPatternSeparator(); tempDS and tempGS is correct, but tempLS always return ';", no matter what setting is. for example, in control panel, when I change regional option to canada, the List separator shoud be ',', but what I get is still tempLS=';' , so how can i get List separator? maybe the method of getPatternSeparator is not the right method to get List Separator? [ September 04, 2003: Message edited by: Justin Jin ]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: How to get List Separator of local system