---
schema_version: "1"
id: f32416b1b7eeecfbfba5706ffe666ca954f397f1e359112d895c8122162f6203
title: writeLinesWith
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.5/dw-binaries-functions-writelineswith.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.5/dw-binaries-functions-writelineswith
source_site: docs.mulesoft.com
content_type: documentation
content_hash: fd41e908a24c267c742abf2edc496c6ec2f25155422f1b6b56ffd92ae4d5f0d3
description: MuleSoft Documentation Site
release: "2.5"
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"
}
```