12 |
public String etage = ""; |
public String etage = ""; |
13 |
public String lejlighed = ""; |
public String lejlighed = ""; |
14 |
public String resten = ""; |
public String resten = ""; |
15 |
|
|
16 |
|
@Override |
17 |
|
public String toString() { |
18 |
|
return vej + " / " + husnr + " / " + litra; |
19 |
|
} |
20 |
|
} |
21 |
|
|
22 |
|
public static char fjernAccentTegn(char c) { |
23 |
|
switch (c) { |
24 |
|
case 'é': |
25 |
|
return 'e'; |
26 |
|
case 'è': |
27 |
|
return 'e'; |
28 |
|
|
29 |
|
case 'û': |
30 |
|
return 'u'; |
31 |
|
case 'ü': |
32 |
|
return 'u'; |
33 |
|
|
34 |
|
case 'ö': |
35 |
|
return 'o'; |
36 |
|
case 'ô': |
37 |
|
return 'o'; |
38 |
|
|
39 |
|
case 'ä': |
40 |
|
return 'a'; |
41 |
|
case 'â': |
42 |
|
return 'a'; |
43 |
|
|
44 |
|
case 'ñ': |
45 |
|
return 'n'; |
46 |
|
|
47 |
|
default: |
48 |
|
return c; |
49 |
|
} |
50 |
} |
} |
51 |
|
|
52 |
public static String vaskVejnavn(String indVejnavn) { |
public static String vaskVejnavn(String indVejnavn) { |
53 |
String out = indVejnavn.toLowerCase(); |
StringBuilder sb = new StringBuilder(); |
54 |
out = out.replace(" ", ""); |
char chars[] = indVejnavn.toCharArray(); |
55 |
out = out.replace(".", ""); |
|
56 |
out = out.replace(",", ""); |
for (char c: chars) { |
57 |
out = out.replace("-", ""); |
if ( Character.isAlphabetic(c)) { |
58 |
out = out.replace("/", ""); |
c = Character.toLowerCase(c); |
59 |
out = out.replace("\\", ""); |
c = fjernAccentTegn(c); |
60 |
out = out.replace("'", ""); |
|
61 |
out = out.replace(";", ""); |
sb.append( c ); |
62 |
out = out.replace(":", ""); |
} else if ( Character.isDigit(c)) { |
63 |
|
sb.append(c); |
64 |
|
} |
65 |
|
|
66 |
|
} |
67 |
|
|
68 |
return out; |
return sb.toString(); |
69 |
} |
} |
70 |
|
|
71 |
public static String injectIntoBk(String bkrute, String injected) { |
public static String injectIntoBk(String bkrute, String injected) { |
104 |
delStreng.append( indAdresse.charAt(i) ); |
delStreng.append( indAdresse.charAt(i) ); |
105 |
i++; |
i++; |
106 |
} |
} |
107 |
result.vej = WordUtils.capitalize( delStreng.toString().trim() ); |
|
108 |
|
|
109 |
|
result.vej = delStreng.toString().toLowerCase().trim(); |
110 |
|
if ( result.vej.endsWith(".") || result.vej.endsWith(",")) { |
111 |
|
result.vej = result.vej.substring(0, result.vej.length() - 1); |
112 |
|
result.vej = result.vej.trim(); |
113 |
|
} |
114 |
|
|
115 |
|
//special case - hvis strengen ender med ' nr' skal ' nr' fjernes |
116 |
|
if ( result.vej.endsWith(" nr")) { |
117 |
|
result.vej = result.vej.substring(0, result.vej.length() - 3); |
118 |
|
} |
119 |
|
|
120 |
|
result.vej = WordUtils.capitalize( result.vej.trim() ); |
121 |
|
|
122 |
|
|
123 |
|
|
162 |
if (i>=len) //THN tilføjelse |
if (i>=len) //THN tilføjelse |
163 |
return result; |
return result; |
164 |
|
|
165 |
if (Character.isAlphabetic(indAdresse.charAt(i) )) { |
if (Character.isAlphabetic(indAdresse.charAt(i) )) { |
166 |
if ( (i+1 == len || |
char current = Character.toUpperCase( indAdresse.charAt(i) ); |
167 |
(Character.isAlphabetic(indAdresse.charAt(i+1)) == false && indAdresse.charAt(i+1) != '.') |
|
168 |
) |
if (current != 'Æ'&& current != 'Ø' && current != 'Å') { |
169 |
) { |
if ( (i+1 == len || |
170 |
result.litra = "" + indAdresse.charAt(i); |
(Character.isAlphabetic(indAdresse.charAt(i+1)) == false |
171 |
result.litra = result.litra.toUpperCase(); |
/*&& indAdresse.charAt(i+1) != '.'*/) |
172 |
i++; |
) |
173 |
|
) { |
174 |
|
result.litra = "" + current; |
175 |
|
i++; |
176 |
|
} |
177 |
} |
} |
178 |
} |
} |
179 |
|
|
180 |
|
// ignorer blanke og komma og punktum |
181 |
|
while (i<len && (indAdresse.charAt(i) == '.' || indAdresse.charAt(i) == ',' || indAdresse.charAt(i) == ' ') ) { |
182 |
|
i++; |
183 |
|
} |
184 |
|
|
185 |
|
|
186 |
|
|
187 |
|
|