Changeset 19437 in josm for trunk/src/org/openstreetmap/josm/tools/Utils.java
- Timestamp:
- 2025-08-26T11:27:22+02:00 (7 months ago)
- File:
-
- 1 edited
-
trunk/src/org/openstreetmap/josm/tools/Utils.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Utils.java
r19378 r19437 2026 2026 } 2027 2027 } 2028 2029 /** 2030 * Calculate the number of unicode code points. See #24446 2031 * @param s the string 2032 * @return 0 if s is null or empty, else the number of code points 2033 * @since 19437 2034 */ 2035 public static int getCodePointCount(String s) { 2036 if (s == null) 2037 return 0; 2038 return s.codePointCount(0, s.length()); 2039 } 2040 2041 /** 2042 * Check if a given string has more than the allowed number of code points. 2043 * See #24446. The OSM server checks this number, not the value returned by String.length() 2044 * @param s the string 2045 * @param maxLen the maximum number of code points 2046 * @return true if s is null or within the given limit, false else 2047 * @since 19437 2048 */ 2049 public static boolean checkCodePointCount(String s, int maxLen) { 2050 return getCodePointCount(s) <= maxLen; 2051 } 2028 2052 }
Note:
See TracChangeset
for help on using the changeset viewer.
