/[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 2382 by torben, Thu Feb 26 10:39:12 2015 UTC revision 2401 by torben, Fri Feb 27 11:05:28 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) {
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(":", "");  
25                                    
26                  return out;                  for (char c: chars) {
27                            if ( Character.isAlphabetic(c)) {
28                                    sb.append(Character.toLowerCase(c) );
29                            }
30                    }              
31                    
32                    return sb.toString();
33          }          }
34                    
35          public static String injectIntoBk(String bkrute, String injected) {          public static String injectIntoBk(String bkrute, String injected) {
# Line 65  public class AddressUtils { Line 68  public class AddressUtils {
68                          delStreng.append( indAdresse.charAt(i) );                          delStreng.append( indAdresse.charAt(i) );
69                          i++;                          i++;
70                  }                  }
71                  result.vej = WordUtils.capitalize( delStreng.toString().trim() );                  
72    
73                    result.vej = delStreng.toString().toLowerCase().trim();
74                    if ( result.vej.endsWith(".") || result.vej.endsWith(",")) {
75                            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")) {
81                            result.vej =  result.vej.substring(0, result.vej.length() - 3);
82                    }
83                    
84                    result.vej = WordUtils.capitalize( result.vej.trim() );
85                                    
86    
87    
# Line 110  public class AddressUtils { Line 126  public class AddressUtils {
126                  if (i>=len) //THN tilføjelse                  if (i>=len) //THN tilføjelse
127                          return result;                          return result;
128                                    
129                  if (Character.isAlphabetic(indAdresse.charAt(i) )) {                                      if (Character.isAlphabetic(indAdresse.charAt(i) )) {
130                          if ( (i+1 == len ||                          char current = Character.toUpperCase( indAdresse.charAt(i) );
131                                          (Character.isAlphabetic(indAdresse.charAt(i+1)) == false && indAdresse.charAt(i+1) != '.')                          
132                                          )                          if (current != 'Æ'&& current != 'Ø' && current != 'Å') {
133                                  ) {                                  if ( (i+1 == len ||
134                                  result.litra = "" + indAdresse.charAt(i);                                                  (Character.isAlphabetic(indAdresse.charAt(i+1)) == false
135                                  result.litra = result.litra.toUpperCase();                                                  /*&& indAdresse.charAt(i+1) != '.'*/)
136                                  i++;                                                  )
137                                            ) {
138                                            result.litra = "" + current;
139                                            i++;
140                                    }
141                          }                          }
142                  }                  }
143                                    
144                    // ignorer blanke og komma og punktum
145                    while (i<len && (indAdresse.charAt(i) == '.' || indAdresse.charAt(i) == ',' || indAdresse.charAt(i) == ' ') ) {
146                            i++;
147                    }
148                    
149    
150    
151                                    

Legend:
Removed from v.2382  
changed lines
  Added in v.2401

  ViewVC Help
Powered by ViewVC 1.1.20