/[projects]/dao/DaoAdresseService/src/dk/daoas/daoadresseservice/AddressUtils.java
ViewVC logotype

Diff of /dao/DaoAdresseService/src/dk/daoas/daoadresseservice/AddressUtils.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2267 by torben, Thu Feb 12 13:57:32 2015 UTC revision 2399 by torben, Fri Feb 27 10:38:50 2015 UTC
# Line 12  public class AddressUtils { Line 12  public class AddressUtils {
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 String vaskVejnavn(String indVejnavn) {          public static String vaskVejnavn(String indVejnavn) {
# Line 23  public class AddressUtils { Line 28  public class AddressUtils {
28                  out = out.replace("/", "");                  out = out.replace("/", "");
29                  out = out.replace("\\", "");                  out = out.replace("\\", "");
30                  out = out.replace("'", "");                  out = out.replace("'", "");
31                    out = out.replace(";", "");
32                    out = out.replace(":", "");
33                    out = out.replace("´", "");
34                    
35                                    
36                  return out;                  return out;
37          }          }
38                    
39            public static String injectIntoBk(String bkrute, String injected) {
40                    String parts[] = bkrute.split("/");
41                    
42                    if (parts.length != 4) {
43                            System.out.println(">BK " + bkrute);
44                            return bkrute;
45                    }
46                    
47                    return parts[0] + "/" + parts[1] + "/" + parts[2] + "/" + injected + parts[3];
48            }
49            
50    
51          /*          /*
52           * Er en 1-1 port af SplitAdresse() fra funcSplitAdresse.php           * Er en 1-1 port af SplitAdresse() fra funcSplitAdresse.php
# Line 52  public class AddressUtils { Line 72  public class AddressUtils {
72                          delStreng.append( indAdresse.charAt(i) );                          delStreng.append( indAdresse.charAt(i) );
73                          i++;                          i++;
74                  }                  }
75                  result.vej = WordUtils.capitalize( delStreng.toString().trim() );                  
76    
77                    result.vej = delStreng.toString().toLowerCase().trim();
78                    if ( result.vej.endsWith(".") || result.vej.endsWith(",")) {
79                            result.vej =  result.vej.substring(0, result.vej.length() - 1);
80                            result.vej = result.vej.trim();
81                    }
82                    
83                    //special case - hvis strengen ender med ' nr' skal ' nr' fjernes
84                    if ( result.vej.endsWith(" nr")) {
85                            result.vej =  result.vej.substring(0, result.vej.length() - 3);
86                    }
87                    
88                    result.vej = WordUtils.capitalize( result.vej.trim() );
89                                    
90    
91    
# Line 97  public class AddressUtils { Line 130  public class AddressUtils {
130                  if (i>=len) //THN tilføjelse                  if (i>=len) //THN tilføjelse
131                          return result;                          return result;
132                                    
133                  if (Character.isAlphabetic(indAdresse.charAt(i)) &&                  if (Character.isAlphabetic(indAdresse.charAt(i) )) {
134                                  (i+1 == len || Character.isAlphabetic(indAdresse.charAt(i+1)) == false                          char current = Character.toUpperCase( indAdresse.charAt(i) );
135                            
136                            if (current != 'Æ'&& current != 'Ø' && current != 'Å') {
137                                    if ( (i+1 == len ||
138                                                    (Character.isAlphabetic(indAdresse.charAt(i+1)) == false
139                                                    /*&& indAdresse.charAt(i+1) != '.'*/)
140                                                  )                                                  )
141                                  ) {                                          ) {
142                          result.litra = "" + indAdresse.charAt(i);                                          result.litra = "" + current;
143                          result.litra = result.litra.toUpperCase();                                          i++;
144                                    }
145                            }
146                    }
147                    
148                    // ignorer blanke og komma og punktum
149                    while (i<len && (indAdresse.charAt(i) == '.' || indAdresse.charAt(i) == ',' || indAdresse.charAt(i) == ' ') ) {
150                          i++;                          i++;
151                  }                  }
152                                    
# Line 191  public class AddressUtils { Line 235  public class AddressUtils {
235                  }                  }
236                                    
237                  // saml resten op (kan gøres smartere med en substr)                  // saml resten op (kan gøres smartere med en substr)
238                  result.resten = indAdresse.substring(i);                  result.resten = indAdresse.substring(i).trim();
239                                    
240                  return result;                  return result;
241          }          }

Legend:
Removed from v.2267  
changed lines
  Added in v.2399

  ViewVC Help
Powered by ViewVC 1.1.20