[Schmitzm-commits] r2202 - trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses
scm-commit at wald.intevation.org
scm-commit at wald.intevation.org
Mon Jan 28 19:44:51 CET 2013
Author: alfonx
Date: 2013-01-28 19:44:51 +0100 (Mon, 28 Jan 2013)
New Revision: 2202
Modified:
trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.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 2013-01-26 18:32:59 UTC (rev 2201)
+++ trunk/schmitzm-adresses/src/main/java/de/schmitzm/adresses/AddrStringUtil.java 2013-01-28 18:44:51 UTC (rev 2202)
@@ -185,29 +185,45 @@
*/
public static String[] split(final String... stringStrHnZusatz) {
+ String removeStrassePrefixTemporarely = null;
+
+ if (stringStrHnZusatz.length > 0 && stringStrHnZusatz[0] != null) {
+ if (stringStrHnZusatz[0].startsWith("3-")) {
+ stringStrHnZusatz[0] = stringStrHnZusatz[0].substring(2);
+ removeStrassePrefixTemporarely = "3-";
+ }
+ }
+
String[] s = splitInternal1(stringStrHnZusatz);
- String[] nervigeZusaetzeAnFalscherStelle = new String[] {
- // "(?i)^(.*\\d.*)(\\d\\.\\d\\d)(.*)$",
- "(?i)^(.*?)\\s*((?:\\d+\\.?)?\\s*\\b(?:reihe|parzell?e|og\\s*(?:rechts|links|zi\\.?|zimmer|li|re|hinten|vorne|)\\.?\\b+\\s*(?:\\d+\\.?)?))+\\s*+(.*?)$",
- };
+ try {
- if (s[0] != null) {
- RegexCache rC = RegexCache.getInstance();
- for (String nZ : nervigeZusaetzeAnFalscherStelle) {
- Matcher matcher = rC.getMatcher(nZ, s[0]);
- if (matcher.find()) {
- s[0] = matcher.group(1);
- if (matcher.group(3).length() > 0)
- s[0] += " " + matcher.group(3);
- // Reihen-Information wegschmeissen
- // if (s[2] == null)
- // s[2] = "";
- // if (s[2].length() > 0)
- // s[2] += " ";
- // s[2] += matcher.group(2);
+ String[] nervigeZusaetzeAnFalscherStelle = new String[] {
+ // "(?i)^(.*\\d.*)(\\d\\.\\d\\d)(.*)$",
+ "(?i)^(.*?)\\s*((?:\\d+\\.?)?\\s*\\b(?:reihe|parzell?e|og\\s*(?:rechts|links|zi\\.?|zimmer|li|re|hinten|vorne|)\\.?\\b+\\s*(?:\\d+\\.?)?))+\\s*+(.*?)$",
+ };
+
+ if (s[0] != null) {
+ RegexCache rC = RegexCache.getInstance();
+ for (String nZ : nervigeZusaetzeAnFalscherStelle) {
+ Matcher matcher = rC.getMatcher(nZ, s[0]);
+ if (matcher.find()) {
+ s[0] = matcher.group(1);
+ if (matcher.group(3).length() > 0)
+ s[0] += " " + matcher.group(3);
+ // Reihen-Information wegschmeissen
+ // if (s[2] == null)
+ // s[2] = "";
+ // if (s[2].length() > 0)
+ // s[2] += " ";
+ // s[2] += matcher.group(2);
+ }
}
}
+ } finally {
+ if (s[0] != null && removeStrassePrefixTemporarely != null) {
+ s[0] = removeStrassePrefixTemporarely + s[0];
+ }
}
return s;
More information about the Schmitzm-commits
mailing list