20 |
} |
} |
21 |
|
|
22 |
public static String vaskVejnavn(String indVejnavn) { |
public static String vaskVejnavn(String indVejnavn) { |
23 |
String out = indVejnavn.toLowerCase(); |
StringBuilder sb = new StringBuilder(); |
24 |
out = out.replace(" ", ""); |
char chars[] = indVejnavn.toCharArray(); |
|
out = out.replace(".", ""); |
|
|
out = out.replace(",", ""); |
|
|
out = out.replace("-", ""); |
|
|
out = out.replace("/", ""); |
|
|
out = out.replace("\\", ""); |
|
|
out = out.replace("'", ""); |
|
|
out = out.replace(";", ""); |
|
|
out = out.replace(":", ""); |
|
|
out = out.replace("ยด", ""); |
|
25 |
|
|
26 |
|
for (char c: chars) { |
27 |
|
if ( Character.isAlphabetic(c)) { |
28 |
|
sb.append(Character.toLowerCase(c) ); |
29 |
|
} |
30 |
|
} |
31 |
|
|
32 |
return out; |
return sb.toString(); |
33 |
} |
} |
34 |
|
|
35 |
public static String injectIntoBk(String bkrute, String injected) { |
public static String injectIntoBk(String bkrute, String injected) { |
69 |
i++; |
i++; |
70 |
} |
} |
71 |
|
|
72 |
//special case - hvis strengen ender med ' nr' skal ' nr' fjernes |
|
73 |
result.vej = delStreng.toString().toLowerCase().trim(); |
result.vej = delStreng.toString().toLowerCase().trim(); |
74 |
if ( result.vej.endsWith(".") || result.vej.endsWith(",")) { |
if ( result.vej.endsWith(".") || result.vej.endsWith(",")) { |
75 |
result.vej = result.vej.substring(0, result.vej.length() - 1); |
result.vej = result.vej.substring(0, result.vej.length() - 1); |
76 |
} |
result.vej = result.vej.trim(); |
77 |
|
} |
78 |
|
|
79 |
|
//special case - hvis strengen ender med ' nr' skal ' nr' fjernes |
80 |
if ( result.vej.endsWith(" nr")) { |
if ( result.vej.endsWith(" nr")) { |
81 |
result.vej = result.vej.substring(0, result.vej.length() - 3); |
result.vej = result.vej.substring(0, result.vej.length() - 3); |
82 |
} |
} |