Changeset 34074 in osm for applications/editors/josm
- Timestamp:
- 2018-02-20T20:03:14+01:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/HouseNumberTaggingTool
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/HouseNumberTaggingTool/src/org/openstreetmap/josm/plugins/housenumbertool/TagDialog.java
r34070 r34074 359 359 360 360 static String incrementHouseNumber(String number, int increment) { 361 try { 362 Matcher m = Pattern.compile("([^\\pN]+)?(\\pN+)([^\\pN]+)?").matcher(number); 363 if (m.matches()) { 364 String prefix = m.group(1) != null ? m.group(1) : ""; 365 int n = Integer.valueOf(m.group(2)) + increment; 366 String suffix = m.group(3) != null ? m.group(3) : ""; 367 return prefix + n + suffix; 368 } 369 } catch (NumberFormatException e) { 370 // Do nothing 361 if (number != null) { 362 try { 363 Matcher m = Pattern.compile("([^\\pN]+)?(\\pN+)([^\\pN]+)?").matcher(number); 364 if (m.matches()) { 365 String prefix = m.group(1) != null ? m.group(1) : ""; 366 int n = Integer.valueOf(m.group(2)) + increment; 367 String suffix = m.group(3) != null ? m.group(3) : ""; 368 return prefix + n + suffix; 369 } 370 } catch (NumberFormatException e) { 371 // Do nothing 372 } 371 373 } 372 374 return null; -
applications/editors/josm/plugins/HouseNumberTaggingTool/test/unit/org/openstreetmap/josm/plugins/housenumbertool/TagDialogTest.java
r34069 r34074 3 3 4 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertNull; 5 6 6 7 import org.junit.Test; … … 22 23 //assertEquals("۲", TagDialog.incrementHouseNumber("۱", 1)); // FIXME: how to increment persian numbers ? 23 24 assertEquals("2", TagDialog.incrementHouseNumber("۱", 1)); 25 assertNull(TagDialog.incrementHouseNumber(null, 1)); 24 26 } 25 27 }
Note:
See TracChangeset
for help on using the changeset viewer.