src/main/java/de/unixwork/uwproj/Util.java

changeset 165
f4f11f755ee7
parent 113
24f32dbd88cd
equal deleted inserted replaced
164:099448bcc943 165:f4f11f755ee7
29 * @param def the default value when the attribute is empty 29 * @param def the default value when the attribute is empty
30 * @return the attribute value or the default 30 * @return the attribute value or the default
31 */ 31 */
32 public static String getAttrOrDefault(Element elm, String attr, String def) { 32 public static String getAttrOrDefault(Element elm, String attr, String def) {
33 final var v = elm.getAttribute(attr); 33 final var v = elm.getAttribute(attr);
34 return v.isBlank() ? def : v; 34 return v.isBlank() ? def : v.trim();
35 } 35 }
36 36
37 /** 37 /**
38 * Returns the text content of the given element with indentation automatically trimmed. 38 * Returns the text content of the given element with indentation automatically trimmed.
39 * 39 *

mercurial