Does #strings.replace() utility method of String object in thymeleaf replaces all occurrences in provided string?

Abhijeet Giram :

I have a string as

str = My name is john.<br> I am software engineer.<br> I am a web developer<br>

I wanted to replace all occurrences that <br> with <br /> in thymeleaf.

I have tried this

${#strings.replace(str,'<br>','<br />')} 

I wanted to know, does above string replace method replace all occurrences of <br>?

References:
https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html
https://www.baeldung.com/spring-thymeleaf-3-expressions

Aman Garg :

Yes, it will replace all the occurrences. Thymeleaf internally calls java.lang.String.replace method to replace the the occurrences.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=123837&siteId=1