thymeleaf - 使用 thymeleaf 从字符串中删除单引号字符
问题描述
我是 thymeleaf 的新手,最近我想弄清楚如何从字符串中删除特殊字符。以下(粗体文本)代码对我有用,但“单引号”除外:
{ #strings.toLowerCase(#strings.replace(#strings.replace(#strings.replace(name, '\'' ,'-'), '&',''),' ','-'))}
我尝试使用 &apos 和 \' 但不工作。我经历了百里香预处理,但无法从中获得任何帮助。有什么办法吗?
解决方案
这对我有用:
${#strings.toLowerCase(#strings.replace(#strings.replace(#strings.replace(name, '''','-'), '&',''),' ','-'))}
推荐阅读
- javascript - 如何在 AngularJS 的 sessionStorage 中存储来自 ng-dropdown-multiselect 的值?
- event-handling - TYPO3:为什么我的 PSR-14 事件侦听器注册不起作用?
- c - 如何使用 Clang 在 Mac OS X 中从 Float 128(大小 16)指定 Float 80(大小 10)?
- php - 收集的数组中未定义的索引
- java - Hibernate 没有正确显示 arraylist 的值
- google-bigquery - 错误的电子邮件从 Google Data Studio 传递到 Google BigQuery
- windows - 有没有一种快速的方法来列出当前 Windows 进程中的线程?
- java - 在 Hazelcast 中面对客户端-服务器的性能问题
- python - 复制目录中的所有文件和文件夹,除了 python 中的 .jpg 和 .png 文件
- c++ - 具有类似界面的 3d 数组的八叉树