Thymeleaf has a number of useful Utils like #strings.capitalize(...) or #lists.isEmpty(...). Trying to add a custom one but have no idea how to register this.
Have made a custom Util class:
public class LabelUtil {
public String[] splitDoubleWord(String str) {
return str.split("[A-Z]", 1);
}
}
Now I'm going to use it like this:
<span th:each="item : ${#labels.splitDoubleWord(name)}" th:text="${item}"></span>
Of course, it won't work due I haven't registered the Util and defined #labels var.
So, the question is how and where to?
Aucun commentaire:
Enregistrer un commentaire