java - thymeleaf 中 String 对象的 #strings.replace() 实用程序方法是否替换了提供的字符串中的所有匹配项?
问题描述
我有一个字符串
str = My name is john.<br> I am software engineer.<br> I am a web developer<br>
我想<br>
用<br />
百里香替换所有出现的地方。
我试过这个
${#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 方法来替换出现的位置。
推荐阅读
- jmeter - JMeter jp@gc 参数化控制器 - 从变量构造对象
- visual-studio-code - vscode 不使用我给他的 python 路径,并且它识别
- bash - 如果长度为 6 个字符(数字),则基于第 3 列的 csv 中的 Bash、grep 行
- java - 如何使用spring集成java DSL向rabbitmq队列发送消息
- java - 使用 Stripe API 的客户对客户付款
- python - 在python中替换反斜杠'\'
- apache-kafka - 无法启动 ksql
- c# - 使用通用接口是否证明使用另一个标记接口是合理的?
- sql - 如何在 SQL 中检查整个表的任何列中的空值
- c - 简单的 HTTP Server C 代码在我的 Mac OS X 上不起作用