Changeset 14438 in josm


Ignore:
Timestamp:
2018-11-20T21:18:32+01:00 (3 weeks ago)
Author:
Don-vip
Message:

fix #16965 - ignore punctuation characters in tagging preset selector

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelector.java

    r14143 r14438  
    127127        }
    128128
     129        private static String simplifyString(String s) {
     130            return Utils.deAccent(s).toLowerCase(Locale.ENGLISH).replaceAll("\\p{Punct}", "");
     131        }
     132
    129133        private static int isMatching(Collection<String> values, String... searchString) {
    130134            int sum = 0;
    131             List<String> deaccentedValues = values.stream().map(
    132                     s -> Utils.deAccent(s).toLowerCase(Locale.ENGLISH)).collect(Collectors.toList());
     135            List<String> deaccentedValues = values.stream()
     136                    .map(PresetClassification::simplifyString).collect(Collectors.toList());
    133137            for (String word: searchString) {
    134138                boolean found = false;
    135139                boolean foundFirst = false;
    136                 String deaccentedWord = Utils.deAccent(word);
     140                String deaccentedWord = simplifyString(word);
    137141                for (String value: deaccentedValues) {
    138142                    int index = value.indexOf(deaccentedWord);
Note: See TracChangeset for help on using the changeset viewer.