Index: trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java	(revision 19258)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java	(revision 19259)
@@ -1035,10 +1035,10 @@
      * @param s The base string
      * @param begin The start index
-     * @param end The end index
+     * @param end The end index. If negative, it counts from the end of the string
      * @return the substring
      * @see String#substring(int, int)
      */
     public static String substring(String s, float begin, float end) {
-        return s == null ? null : s.substring((int) begin, (int) end);
+        return s == null ? null : s.substring((int) begin, (int) (end >= 0 ? end : s.length() + end));
     }
 
