PasteUtils { public static String translateSeparators(String input, Locale locale) { if (input == null) { return null; } DecimalFormat format = (DecimalFormat) DecimalFormat.getInstance(locale); char decimalSeparator = format.getDecimalFormatSymbols().getDecimalSeparator(); if (decimalSeparator == '.') { input = input.replace(',', '.'); } else { input = input.replace('.', ','); } return input; } private  PasteUtils(); static String[] split(Object input); static Integer toInt(String input); static String translateSeparators(String input, Locale locale); static String stripSeparators(String input);  }
@Test public void testTranslateSeparators() { assertEquals("2,3", PasteUtils.translateSeparators("2,3", new Locale("nl"))); assertEquals("2,3", PasteUtils.translateSeparators("2.3", new Locale("nl"))); assertEquals("2.3", PasteUtils.translateSeparators("2,3", new Locale("us"))); assertEquals("2.3", PasteUtils.translateSeparators("2.3", new Locale("us"))); }