Changeset 18894 in osm
- Timestamp:
- 2009-12-02T17:03:12+01:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/StringUtils.java
r16417 r18894 111 111 } 112 112 113 public static String tryTrim(String s) { 114 if (s == null) return null; 115 return s.trim(); 116 } 117 113 118 /** 114 119 * Capitalizes the given string (first letter of every word upper-case, -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/parser/MvcrParser.java
r15763 r18894 2 2 3 3 import static org.openstreetmap.josm.plugins.czechaddress.StringUtils.capitalize; 4 import static org.openstreetmap.josm.plugins.czechaddress.StringUtils.tryTrim; 4 5 5 6 import java.io.FileInputStream; … … 43 44 if (name.equals("a")) { 44 45 45 String cp = attributes.getValue("p");46 String co = attributes.getValue("o");46 String cp = tryTrim(attributes.getValue("p")); 47 String co = tryTrim(attributes.getValue("o")); 47 48 if ((cp == null) && (co == null)) 48 49 return; … … 59 60 // ========== PARSING STREET ========== // 60 61 if (name.equals("ulice")) { 61 String nazev = attributes.getValue("nazev");62 String nazev = tryTrim(attributes.getValue("nazev")); 62 63 63 64 // If the street filter is on, apply it! … … 85 86 return; 86 87 87 String nazev = attributes.getValue("nazev");88 String nazev = tryTrim(attributes.getValue("nazev")); 88 89 89 90 // If the suburb filter is on, apply it! … … 106 107 if (name.equals("obec")) { 107 108 108 String nazev = attributes.getValue("nazev");109 String nazev = tryTrim(attributes.getValue("nazev")); 109 110 110 111 // If the viToCi filter is on, apply it! … … 129 130 130 131 // If the region filter is on, apply it! 131 if (filRegion != null && !attributes.getValue("nazev").equals(filRegion)) { 132 if (filRegion != null && 133 !attributes.getValue("nazev").trim().equals(filRegion)) { 132 134 curRegion = null; 133 135 curViToCi = null; … … 144 146 if (curRegion == null) {*/ 145 147 curRegion = new Region( 146 capitalize( attributes.getValue("nazev")),147 capitalize( attributes.getValue("kraj")),148 capitalize( attributes.getValue("okres")));148 capitalize(tryTrim(attributes.getValue("nazev"))), 149 capitalize(tryTrim(attributes.getValue("kraj"))), 150 capitalize(tryTrim(attributes.getValue("okres")))); 149 151 150 152 target.regions.add(curRegion);
Note:
See TracChangeset
for help on using the changeset viewer.