Ignore:
Timestamp:
2016-03-06T17:12:42+01:00 (8 years ago)
Author:
simon04
Message:

see #12554 - Allow to ignore keys/tags from recent tags

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java

    r9930 r9940  
    17451745        return searchFlags;
    17461746    }
     1747
     1748    static String escapeStringForSearch(String s) {
     1749        return s.replace("\\", "\\\\").replace("\"", "\\\"");
     1750    }
     1751
     1752    /**
     1753     * Builds a search string for the given tag. If value is empty, the existence of the key is checked.
     1754     *
     1755     * @param key   the tag key
     1756     * @param value the tag value
     1757     * @return a search string for the given tag
     1758     */
     1759    public static String buildSearchStringForTag(String key, String value) {
     1760        final String forKey = '"' + escapeStringForSearch(key) + '"' + '=';
     1761        if (value == null || value.isEmpty()) {
     1762            return forKey + "*";
     1763        } else {
     1764            return forKey + '"' + escapeStringForSearch(value) + '"';
     1765        }
     1766    }
    17471767}
Note: See TracChangeset for help on using the changeset viewer.