我有一个字符串作为
str = My name is john.<br> I am software engineer.<br> I am a web developer<br>
我想替换所有出现的 <br>
与 <br />
在 thymeleaf 中。
我试过了
${#strings.replace(str,'<br>','<br />')}
我想知道,上面的字符串替换方法是否替换了所有出现的 <br>
?
引用资料:
https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html
https://www.baeldung.com/spring-thymeleaf-3-expressions
最佳答案
是的,它将替换所有出现的地方。 Thymeleaf 在内部调用 java.lang.String.replace 方法来替换出现的位置。
关于java - thymeleaf 中 String 对象的 #strings.replace() 实用方法是否替换了提供的字符串中的所有匹配项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56768219/