@Test public void testNormalize_withLineBreak() { final String input = "text\nover\nmultiple\nlines"; final String expected= "text_over_multiple_lines"; final String actual= BundleNormalizer.normalize(input); assertThat(actual).isEqualTo(expected); }
protected static String normalize(String s) { Require.nonNull(s, "parameter s may not be null or empty."); s= replaceUmlauts(s); s= s.replaceAll("[\\ \\.\\-\n/]+", "_"); s= Normalizer .normalize(s, Normalizer.Form.NFKD) .replaceAll("[^\\P{M}]", "") .replaceAll("[^\\p{Alnum}\\_\\-\\ ]", ""); s= s.replaceAll("[_]+", "_"); s= s.replaceAll("^_", "").replaceAll("_$", ""); return s; }
BundleNormalizer { protected static String normalize(String s) { Require.nonNull(s, "parameter s may not be null or empty."); s= replaceUmlauts(s); s= s.replaceAll("[\\ \\.\\-\n/]+", "_"); s= Normalizer .normalize(s, Normalizer.Form.NFKD) .replaceAll("[^\\P{M}]", "") .replaceAll("[^\\p{Alnum}\\_\\-\\ ]", ""); s= s.replaceAll("[_]+", "_"); s= s.replaceAll("^_", "").replaceAll("_$", ""); return s; } }
BundleNormalizer { protected static String normalize(String s) { Require.nonNull(s, "parameter s may not be null or empty."); s= replaceUmlauts(s); s= s.replaceAll("[\\ \\.\\-\n/]+", "_"); s= Normalizer .normalize(s, Normalizer.Form.NFKD) .replaceAll("[^\\P{M}]", "") .replaceAll("[^\\p{Alnum}\\_\\-\\ ]", ""); s= s.replaceAll("[_]+", "_"); s= s.replaceAll("^_", "").replaceAll("_$", ""); return s; }  }
BundleNormalizer { protected static String normalize(String s) { Require.nonNull(s, "parameter s may not be null or empty."); s= replaceUmlauts(s); s= s.replaceAll("[\\ \\.\\-\n/]+", "_"); s= Normalizer .normalize(s, Normalizer.Form.NFKD) .replaceAll("[^\\P{M}]", "") .replaceAll("[^\\p{Alnum}\\_\\-\\ ]", ""); s= s.replaceAll("[_]+", "_"); s= s.replaceAll("^_", "").replaceAll("_$", ""); return s; }  static String toClassName(String s); static String toFieldName(String s); static String toConstName(String s); static String toBundleName(String s); }
BundleNormalizer { protected static String normalize(String s) { Require.nonNull(s, "parameter s may not be null or empty."); s= replaceUmlauts(s); s= s.replaceAll("[\\ \\.\\-\n/]+", "_"); s= Normalizer .normalize(s, Normalizer.Form.NFKD) .replaceAll("[^\\P{M}]", "") .replaceAll("[^\\p{Alnum}\\_\\-\\ ]", ""); s= s.replaceAll("[_]+", "_"); s= s.replaceAll("^_", "").replaceAll("_$", ""); return s; }  static String toClassName(String s); static String toFieldName(String s); static String toConstName(String s); static String toBundleName(String s);  }