[Schmitzm-commits] r1883 - in trunk/schmitzm-adresses/src: main/java/de/schmitzm/adresses test/java/de/schmitzm/adresses

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Wed Feb 29 14:53:58 CET 2012


Author: alfonx
Date: 2012-02-29 14:53:58 +0100 (Wed, 29 Feb 2012)
New Revision: 1883

Modified:
   trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java
   trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java
Log:


Modified: trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java
===================================================================
--- trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java	2012-02-29 13:48:25 UTC (rev 1882)
+++ trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java	2012-02-29 13:53:58 UTC (rev 1883)
@@ -9,6 +9,7 @@
 import java.util.regex.Pattern;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.WordUtils;
 import org.apache.log4j.Logger;
 
 import de.schmitzm.lang.LangUtil;
@@ -547,8 +548,10 @@
 		strasse = strasse.replaceAll("\\s\\s+", " ");
 		strasse = strasse.replaceAll("\\s+-\\s+", "-");
 		strasse = strasse.replaceAll("tra(ss|ß)e\\b", "tr.");
-		strasse = strasse.replaceAll("str[^\\.]\\b", "str.");
+		strasse = strasse.replaceAll("str[^\\.]", "str.");
 		strasse = strasse.replaceAll("([^\\d^\\s])(\\d)", "$1 $2");
+		strasse = strasse.replaceAll("str$", "str.");
+		strasse = WordUtils.capitalize(strasse, new char[] { ' ', '-' });
 		return strasse;
 	}
 

Modified: trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java
===================================================================
--- trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java	2012-02-29 13:48:25 UTC (rev 1882)
+++ trunk/schmitzm-adresses/src/test/java/de/schmitzm/adresses/AddrStringUtilTest.java	2012-02-29 13:53:58 UTC (rev 1883)
@@ -328,6 +328,8 @@
 		assertEquals("Sternstr.", AddrStringUtil.saeubereStrassenname("Sternstraße"));
 		assertEquals("Sternstr.", AddrStringUtil.saeubereStrassenname("Sternstrasse"));
 		assertEquals("Hans-Wurststr. 3", AddrStringUtil.saeubereStrassenname("Hans - Wurststr 3"));
+		assertEquals("Hans-Wurststr. 3", AddrStringUtil.saeubereStrassenname("<br/>Hans - Wurststr 3<br/>"));
+		assertEquals("Hans-Wurststr. 3", AddrStringUtil.saeubereStrassenname("hans - wurststr 3"));
 		assertEquals("Hans-Wurststr.", AddrStringUtil.saeubereStrassenname("Hans - Wurststr"));
 	}
 }



More information about the Schmitzm-commits mailing list