【发布时间】:2020-12-22 00:34:51
【问题描述】:
在 Mule 3 DataWeave 中,如何将一个长字符串按设定的长度分成多行?
例如,我有以下 JSON 输入:
{
"id" : "123",
"text" : "There is no strife, no prejudice, no national conflict in outer space as yet. Its hazards are hostile to us all. Its conquest deserves the best of all mankind, and its opportunity for peaceful cooperation many never come again."
}
输入系统只能接受不超过40个字符的字符串,所以输出的XML需要符合如下:
<data>
<id>123</id>
<text>
<line>There is no strife, no prejudice, no nat</line>
<line>ional conflict in outer space as yet. It</line>
<line>s hazards are hostile to us all. Its con</line>
<line>quest deserves the best of all mankind, </line>
<line>and its opportunity for peaceful coopera</line>
<line>tion many never come again.</line>
</text>
</data>
我知道splitBy 可以使用分隔符,但我想使用任意长度。
【问题讨论】:
标签: xml split dataweave mulesoft