1 13 package com.tonbeller.jpivot.util; 14 15 import java.util.Locale ; 16 17 22 public class NumSeparators { 23 public int thouSep; public int decimalSep; private Locale theLocale; 26 static private NumSeparators theInstance = null; 27 28 private NumSeparators(Locale locale) { 29 theLocale = locale; 30 thouSep = ','; 31 decimalSep = '.'; 32 if (locale == null) 33 return; 34 if (locale.getLanguage() == "de" || locale.getCountry() == "DE") { 35 decimalSep = ','; 36 thouSep = '.'; 37 } else if (locale.getLanguage() == "hu" || locale.getCountry() == "HU") { 38 decimalSep = ','; 39 thouSep = ' '; 40 } 41 } 42 43 static public NumSeparators instance(Locale locale) { 44 if (theInstance == null) 46 return new NumSeparators(locale); 47 if (theInstance.theLocale == locale) 48 return theInstance; 49 if (locale != null && locale.equals(theInstance.theLocale)) { return theInstance; } 50 return new NumSeparators(locale); 52 } 53 } | Popular Tags |