-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
1.2.0
-
sparc
-
solaris_2.5
import java.text.NumberFormat;
import java.text.DecimalFormat;
import java.util.Locale;
import java.text.ParseException;
class Main {
public static void main(String[] args) {
NumberFormat nf = NumberFormat.getInstance(Locale.FRANCE);
System.out.println("nf toPattern1: " + ((DecimalFormat)nf).toPattern());
System.out.println("nf toLocPattern1: " + ((DecimalFormat)nf).toLocalizedPattern());
// No group separator
System.out.println("\n...applyLocalizedPattern ###,00;(###,00) ");
((DecimalFormat)nf).applyLocalizedPattern("###,00;(###,00)");
System.out.println("nf toPattern2: " + ((DecimalFormat)nf).toPattern());
System.out.println("nf toLocPattern2: " + ((DecimalFormat)nf).toLocalizedPattern());
System.out.println("nf: " + nf.format(1234)); // 1234,00
System.out.println("nf: " + nf.format(-1234)); // (1234,00)
// Space as group separator
System.out.println("\n...applyLocalizedPattern # ###,00;(# ###,00) ");
((DecimalFormat)nf).applyLocalizedPattern("# ###,00;(# ###,00)");
System.out.println("nf toPattern2: " + ((DecimalFormat)nf).toPattern());
System.out.println("nf toLocPattern2: " + ((DecimalFormat)nf).toLocalizedPattern());
System.out.println("nf: " + nf.format(1234)); // Expect 1 234,00
System.out.println("nf: " + nf.format(-1234)); // Expect (1 234,00)
// Erroneously prints:
// 1234,00 ,
// (1234,00 ,)
}
}
Output is:
% javac Main1.java
[doog]/home/dkramer/tmp % java Main1
nf toPattern1: #,##0.###
nf toLocPattern1: # ##0,###
...applyLocalizedPattern ###,00;(###,00)
nf toPattern2: #.00;(#.00)
nf toLocPattern2: #,00;(#,00)
nf: 1234,00
nf: (1234,00)
...applyLocalizedPattern # ###,00;(# ###,00)
nf toPattern2: #.00### ,;(#.00### ,)
nf toLocPattern2: #,00### ,;(#,00### ,)
nf: 1234,00 ,
nf: (1234,00 ,)
I believe the separators for the last give lines should look like:
...applyLocalizedPattern # ###,00;(# ###,00)
nf toPattern2: # ###,00;(# ###,00)
nf toLocPattern2: # ###,00;(# ###,00)
nf: 1 234,00
nf: (1 234,00)
import java.text.DecimalFormat;
import java.util.Locale;
import java.text.ParseException;
class Main {
public static void main(String[] args) {
NumberFormat nf = NumberFormat.getInstance(Locale.FRANCE);
System.out.println("nf toPattern1: " + ((DecimalFormat)nf).toPattern());
System.out.println("nf toLocPattern1: " + ((DecimalFormat)nf).toLocalizedPattern());
// No group separator
System.out.println("\n...applyLocalizedPattern ###,00;(###,00) ");
((DecimalFormat)nf).applyLocalizedPattern("###,00;(###,00)");
System.out.println("nf toPattern2: " + ((DecimalFormat)nf).toPattern());
System.out.println("nf toLocPattern2: " + ((DecimalFormat)nf).toLocalizedPattern());
System.out.println("nf: " + nf.format(1234)); // 1234,00
System.out.println("nf: " + nf.format(-1234)); // (1234,00)
// Space as group separator
System.out.println("\n...applyLocalizedPattern # ###,00;(# ###,00) ");
((DecimalFormat)nf).applyLocalizedPattern("# ###,00;(# ###,00)");
System.out.println("nf toPattern2: " + ((DecimalFormat)nf).toPattern());
System.out.println("nf toLocPattern2: " + ((DecimalFormat)nf).toLocalizedPattern());
System.out.println("nf: " + nf.format(1234)); // Expect 1 234,00
System.out.println("nf: " + nf.format(-1234)); // Expect (1 234,00)
// Erroneously prints:
// 1234,00 ,
// (1234,00 ,)
}
}
Output is:
% javac Main1.java
[doog]/home/dkramer/tmp % java Main1
nf toPattern1: #,##0.###
nf toLocPattern1: # ##0,###
...applyLocalizedPattern ###,00;(###,00)
nf toPattern2: #.00;(#.00)
nf toLocPattern2: #,00;(#,00)
nf: 1234,00
nf: (1234,00)
...applyLocalizedPattern # ###,00;(# ###,00)
nf toPattern2: #.00### ,;(#.00### ,)
nf toLocPattern2: #,00### ,;(#,00### ,)
nf: 1234,00 ,
nf: (1234,00 ,)
I believe the separators for the last give lines should look like:
...applyLocalizedPattern # ###,00;(# ###,00)
nf toPattern2: # ###,00;(# ###,00)
nf toLocPattern2: # ###,00;(# ###,00)
nf: 1 234,00
nf: (1 234,00)