---
schema_version: "1"
id: b143116962df1b4f82eaf788eef30b6a9c216a763ec161c74c54f4b3c54489fd
title: writeLinesWith
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.4/dw-binaries-functions-writelineswith.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.4/dw-binaries-functions-writelineswith
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 25330c7d4286df6f8cb1b68cfd62afec9bb253d45a86d9dde67087fc0c2c467a
description: MuleSoft Documentation Site
release: "2.4"
latest: false
---
# writeLinesWith

## [](#writelineswith1)writeLinesWith(content: Array<String>, charset: String): Binary

指定された行を書き込んで、バイナリコンテンツを返します。

_DataWeave バージョン 2.2.0 で導入されました。_​

### [](#パラメーター)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">​<code>content</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">書き込む項目の配列。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">​<code>charset</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">書き込み時に使用するエンコードを表す文字列。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、改行 (​`\n`​) を各反復の後に挿入します。具体的には、​`map`​ を使用して ​`to(1, 10)`​ の結果 (​`[1,2,3,4,5]`​) を反復処理した後、指定されたコンテンツ ("Line $") を書き込みます。このコンテンツには、配列内の各番号の代わりに名前のない変数 ​`$`​ が含まれます。

`writeLinesWith "UTF-8"`​ のない式 ​`{ lines: to(1, 10) map "Line $" }`​ では、オブジェクトの値として単に行番号の配列 (​`{ "lines": [ "line 1", "line 2", "line 3", "line 4", "line 5" ] }`​) が返されます。

#### [](#ソース)ソース

```DataWeave
%dw 2.0
import * from dw::core::Binaries
output application/json
---
{ lines: to(1, 10) map "Line $" writeLinesWith  "UTF-8" }
```

#### [](#出力)出力

```JSON
{
  "lines": "Line 1\nLine 2\nLine 3\nLine 4\nLine 5\n"
}
```