Changeset 3842 in josm
- Timestamp:
- 2011-02-01T21:52:57+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r3839 r3842 418 418 String def = default_; 419 419 420 String[] value_array = values.split(",");420 String[] value_array = splitEscaped(values); 421 421 String[] display_array; 422 422 String[] short_descriptions_array = null; … … 556 556 // "A\, B\, C,one\, two" --> ["A, B, C", "one, two"] 557 557 private static String[] splitEscaped(String s) { 558 String[] res = s.replaceAll("\\\\,", "\u0091").split(","); 559 for (int i=0; i<res.length; ++i) { 560 res[i] = res[i].replaceAll("\u0091", ","); 561 } 562 return res; 558 List<String> result = new ArrayList<String>(); 559 boolean backslash = false; 560 StringBuffer item = new StringBuffer(); 561 for (int i=0; i<s.length(); i++) { 562 char ch = s.charAt(i); 563 if (backslash) { 564 item.append(ch); 565 backslash = false; 566 } else if (ch == '\\') { 567 backslash = true; 568 } else if (ch == ',') { 569 result.add(item.toString()); 570 item.setLength(0); 571 } else { 572 item.append(ch); 573 } 574 } 575 return result.toArray(new String[result.size()]); 563 576 } 564 577
Note:
See TracChangeset
for help on using the changeset viewer.