简体   繁体   English

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

[英]Dataweave - String array remove square brackets

I get this string array :我得到这个字符串数组

["HELLO","WORLD"]

And I want to output the same but without square brackets:我想输出相同但没有方括号:

"HELLO","WORLD"

How can I replace or transform this with Dataweave in Mule?如何在 Mule 中使用Dataweave替换或转换它?

Possible solutions (credit to @jerney in the comments)可能的解决方案(在评论中归功于@jerney)

Using index manipulation:使用索引操作:

%dw 1.0
%output application/java

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

Using regex:使用正则表达式:

%dw 1.0
%output application/java

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

Using simple replacement:使用简单替换:

%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