Changeset 15904 in josm for trunk/src/com/kitfox/svg/xml/XMLParseUtil.java
- Timestamp:
- 2020-02-22T19:40:29+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/kitfox/svg/xml/XMLParseUtil.java
r14598 r15904 302 302 * @param map - A map to which these styles will be added 303 303 */ 304 public static HashMap<String, StyleAttribute> parseStyle(String styleString, HashMap<String, StyleAttribute> map) {304 public static void parseStyle(String styleString, HashMap<String, String> map) { 305 305 final Pattern patSemi = Pattern.compile(";"); 306 306 307 String[] styles = patSemi.split(styleString); 308 309 for (int i = 0; i < styles.length; i++) 310 { 311 if (styles[i].length() == 0) 312 { 313 continue; 314 } 315 316 int colon = styles[i].indexOf(':'); 317 if (colon == -1) 318 { 319 continue; 320 } 321 322 String key = styles[i].substring(0, colon).trim().intern(); 323 String value = quoteMatch.reset(styles[i].substring(colon + 1).trim()).replaceAll("").intern(); 324 325 map.put(key, new StyleAttribute(key, value)); 326 } 327 328 return map; 307 // com.kitfox.svg.xml.StyleAttribute 58,595 (3.6%) 1,992,230 B (1.4%) n/a 308 patSemi.splitAsStream(styleString) 309 .filter(style -> !style.isEmpty()) 310 .forEach(style -> { 311 int colon = style.indexOf(':'); 312 if (colon == -1) return; 313 String key = style.substring(0, colon).trim().intern(); 314 String value = quoteMatch.reset(style.substring(colon + 1).trim()).replaceAll("").intern(); 315 map.put(key, value); 316 }); 329 317 } 330 318 }
Note:
See TracChangeset
for help on using the changeset viewer.