我明白了 字符串数组 :
["HELLO","WORLD"]
我想输出相同的,但没有方括号:
"HELLO","WORLD"
我如何用 在骡子里?
可能的解决方案(评论中提到@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 ""