Ignore:
Timestamp:
2018-04-04T19:47:35+02:00 (19 months ago)
Author:
Don-vip
Message:

fix #16145 - remove white spaces from key/values when pasting tags

Location:
trunk/src/org/openstreetmap/josm/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/TextTagParser.java

    r13544 r13597  
    5959            Matcher m = p.matcher(line);
    6060            if (m.matches()) {
    61                  k = m.group(1).trim();
    62                  v = m.group(2).trim();
     61                 k = Utils.removeWhiteSpaces(m.group(1));
     62                 v = Utils.removeWhiteSpaces(m.group(2));
    6363                 if (unescapeTextInQuotes) {
    6464                     k = unescape(k);
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r13520 r13597  
    823823
    824824    /**
     825     * Removes leading, trailing, and multiple inner whitespaces from the given string, to be used as a key or value.
     826     * @param s The string
     827     * @return The string without leading, trailing or multiple inner whitespaces
     828     * @since 13597
     829     */
     830    public static String removeWhiteSpaces(String s) {
     831        if (s == null || s.isEmpty()) {
     832            return s;
     833        }
     834        return strip(s).replaceAll("\\s+", " ");
     835    }
     836
     837    /**
    825838     * Runs an external command and returns the standard output.
    826839     *
Note: See TracChangeset for help on using the changeset viewer.