繁体   English   中英

Dataweave - 字符串数组删除方括号

[英]Dataweave - String array remove square brackets

我得到这个字符串数组

["HELLO","WORLD"]

我想输出相同但没有方括号:

"HELLO","WORLD"

如何在 Mule 中使用Dataweave替换或转换它?

可能的解决方案(在评论中归功于@jerney)

使用索引操作:

%dw 1.0
%output application/java

%var input = "[\"HELLO\", \"WORLD\"]"
---
input[1..-2]

使用正则表达式:

%dw 1.0
%output application/java

%var input = "[\"HELLO\", \"WORLD\"]"
---
input replace /^\[|\]$/ with ""

使用简单替换:

%dw 1.0
%output application/java

%var input = "[\"HELLO\", \"WORLD\"]"
---
input replace "[" with "" replace "]" with ""

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM