Changeset 11756 in josm for trunk/src/org


Ignore:
Timestamp:
2017-03-20T23:44:44+01:00 (7 years ago)
Author:
Don-vip
Message:

fix #14425 - Improve Wikipedia tag validators (patch by nyurik, modified)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java

    r11713 r11756  
    832832
    833833        /**
     834         * Converts string {@code s} to uppercase.
     835         * @param s The source string
     836         * @return The resulting string
     837         * @see String#toUpperCase(Locale)
     838         * @since 11756
     839         */
     840        public static String upper(String s) {
     841            return s == null ? null : s.toUpperCase(Locale.ENGLISH);
     842        }
     843
     844        /**
     845         * Converts string {@code s} to lowercase.
     846         * @param s The source string
     847         * @return The resulting string
     848         * @see String#toLowerCase(Locale)
     849         * @since 11756
     850         */
     851        public static String lower(String s) {
     852            return s == null ? null : s.toLowerCase(Locale.ENGLISH);
     853        }
     854
     855        /**
     856         * Trim whitespaces from the string {@code s}.
     857         * @param s The source string
     858         * @return The resulting string
     859         * @see Utils#strip
     860         * @since 11756
     861         */
     862        public static String trim(String s) {
     863            return Utils.strip(s);
     864        }
     865
     866        /**
     867         * Percent-decode a string. (See https://en.wikipedia.org/wiki/Percent-encoding)
     868         * This is especially useful for wikipedia titles
     869         * @param s url-encoded string
     870         * @return the decoded string, or original in case of an error
     871         * @since 11756
     872         */
     873        public static String URL_decode(String s) {
     874            if (s == null) return null;
     875            try {
     876                return Utils.decodeUrl(s);
     877            } catch (IllegalStateException e) {
     878                Main.debug(e);
     879                return s;
     880            }
     881        }
     882
     883        /**
    834884         * Percent-encode a string. (See https://en.wikipedia.org/wiki/Percent-encoding)
    835885         * This is especially useful for data urls, e.g.
Note: See TracChangeset for help on using the changeset viewer.