Changeset 19259 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2024-11-15T17:20:57+01:00 (2 months ago)
Author:
stoecker
Message:

fix #23943 - patch by Famlam - allow negative values for substring to count from the end of the string

File:
1 edited

Legend:

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

    r19092 r19259  
    10351035     * @param s The base string
    10361036     * @param begin The start index
    1037      * @param end The end index
     1037     * @param end The end index. If negative, it counts from the end of the string
    10381038     * @return the substring
    10391039     * @see String#substring(int, int)
    10401040     */
    10411041    public static String substring(String s, float begin, float end) {
    1042         return s == null ? null : s.substring((int) begin, (int) end);
     1042        return s == null ? null : s.substring((int) begin, (int) (end >= 0 ? end : s.length() + end));
    10431043    }
    10441044
Note: See TracChangeset for help on using the changeset viewer.