replace - 液体转换:替换/用
问题描述
用液体转换替换子字符串时遇到了一些麻烦。这是我想用点替换正斜杠的输出。
"ProductName": "2x19/ display in control room"
我的代码如下所示:
[
{% for Order_var in content[0].ListOfSmsOrderEntrySales.OrderEntry-Orders.ListOfOrderEntry-LineItems.OrderEntry-LineItems %}
{
"Id":"{{Order_var.Id}}",
"PartNumber":"{{Order_var.PartNumber}}",
"Product":"{{Order_var.Product}}",
"ProductDefTypeCode":"{{Order_var.ProductDefTypeCode}}",
"ProductId":"{{Order_var.ProductId}}",
"ProductIntegrationId":"{{Order_var.ProductIntegrationId}}",
"NetPrice":"{{Order_var.NetPrice}}",
"ProductName":"{{Order_var.Description2 | replace: '/', '.' }}",
},
{% endfor %}
]
我仍然得到相同的输出,没有替换。任何想法?不胜感激 干杯
解决方案
请使用Replace
但不要replace
在您的液体模板中使用。液体的文件显示,但根据测试,我们需要在液体模板{{ "Take my protein pills and put my helmet on" | replace: "my", "your" }}
中使用大写。Replace