/[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 2398 by torben, Fri Feb 27 10:37:08 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                    //special case - hvis strengen ender med ' nr' skal ' nr' fjernes
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                    }              
81                    if ( result.vej.endsWith(" nr")) {
82                            result.vej =  result.vej.substring(0, result.vej.length() - 3);
83                    }
84                    
85                    result.vej = WordUtils.capitalize( result.vej.trim() );
86                                    
87    
88    
# Line 97  public class AddressUtils { Line 127  public class AddressUtils {
127                  if (i>=len) //THN tilføjelse                  if (i>=len) //THN tilføjelse
128                          return result;                          return result;
129                                    
130                  if (Character.isAlphabetic(indAdresse.charAt(i)) &&                  if (Character.isAlphabetic(indAdresse.charAt(i) )) {
131                                  (i+1 == len || Character.isAlphabetic(indAdresse.charAt(i+1)) == false                          char current = Character.toUpperCase( indAdresse.charAt(i) );
132                            
133                            if (current != 'Æ'&& current != 'Ø' && current != 'Å') {
134                                    if ( (i+1 == len ||
135                                                    (Character.isAlphabetic(indAdresse.charAt(i+1)) == false
136                                                    /*&& indAdresse.charAt(i+1) != '.'*/)
137                                                  )                                                  )
138                                  ) {                                          ) {
139                          result.litra = "" + indAdresse.charAt(i);                                          result.litra = "" + current;
140                          result.litra = result.litra.toUpperCase();                                          i++;
141                                    }
142                            }
143                    }
144                    
145                    // ignorer blanke og komma og punktum
146                    while (i<len && (indAdresse.charAt(i) == '.' || indAdresse.charAt(i) == ',' || indAdresse.charAt(i) == ' ') ) {
147                          i++;                          i++;
148                  }                  }
149                                    
# Line 191  public class AddressUtils { Line 232  public class AddressUtils {
232                  }                  }
233                                    
234                  // saml resten op (kan gøres smartere med en substr)                  // saml resten op (kan gøres smartere med en substr)
235                  result.resten = indAdresse.substring(i);                  result.resten = indAdresse.substring(i).trim();
236                                    
237                  return result;                  return result;
238          }          }

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

  ViewVC Help
Powered by ViewVC 1.1.20