---
schema_version: "1"
id: f8861b5d4e80cc9559ab421a888eda5072cca50d0f50f242b2c8507277e2d90c
title: Coercions (dw::util::Coercions)
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.8/dw-coercions.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions
source_site: docs.mulesoft.com
content_type: documentation
content_hash: e208a973784ee09c944bc105e658a7106a9920dc0fe64905605efd61316eea9e
description: MuleSoft Documentation Site
release: "2.8"
latest: false
---
# Coercions (dw::util::Coercions)

このユーティリティモジュールは型の強制を強化します。

このモジュールを使用するには、DataWeave コードにインポートする必要があります。その方法として、たとえば、行 ​`import * from dw::util::Coercions`​ を DataWeave スクリプトの ヘッダーに追加します。

_DataWeave バージョン 2.4.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"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-toarray" class="xref page">toArray</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code>​ 値を文字の ​<code>Array</code>​ に分割します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-tobinary" class="xref page">toBinary</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">指定されたエンコーディングを使用して ​<code>String</code>​ 値を ​<code>Binary</code>​ 値に変換します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-toboolean" class="xref page">toBoolean</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code>​ 値を ​<code>Boolean</code>​ 値に変換します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-todate" class="xref page">toDate</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">変換する特定の値に一致する最初の​<code>フォーマッター</code>​を使用して、​<code>String</code>​ 値を ​<code>Date</code>​ 値に変換します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-todateornull" class="xref page">toDateOrNull</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">変換する特定の値に一致する最初の​<code>フォーマッター</code>​を使用して、​<code>String</code>​ 値を ​<code>Date</code>​ 値に変換します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-todatetime" class="xref page">toDateTime</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">変換する特定の値と一致する最初の ​<code>Formatter</code>​ を使用して、​<code>String</code>​ 値を ​<code>DateTime</code>​ 値に変換します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-todatetimeornull" class="xref page">toDateTimeOrNull</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">変換する特定の値と一致する最初の ​<code>Formatter</code>​ を使用して、​<code>String</code>​ 値を ​<code>DateTime</code>​ 値に変換します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-tolocaldatetime" class="xref page">toLocalDateTime</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">変換する特定の値に一致する最初の​<code>フォーマッター</code>​を使用して、​<code>String</code>​ 値を ​<code>LocalDateTime</code>​ 値に変換します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-tolocaldatetimeornull" class="xref page">toLocalDateTimeOrNull</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">変換する特定の値に一致する最初の​<code>フォーマッター</code>​を使用して、​<code>String</code>​ 値を ​<code>LocalDateTime</code>​ 値に変換します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-tolocaltime" class="xref page">toLocalTime</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">変換する特定の値に一致する最初の​<code>フォーマッター</code>​を使用して、​<code>String</code>​ 値を ​<code>LocalTime</code>​ 値に変換します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-tolocaltimeornull" class="xref page">toLocalTimeOrNull</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">変換する特定の値に一致する最初の​<code>フォーマッター</code>​を使用して、​<code>String</code>​ 値を ​<code>LocalTime</code>​ 値に変換します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-tonumber" class="xref page">toNumber</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">変換する特定の値と一致する最初の ​<code>Formatter</code>​ を使用して、​<code>String</code>​ 値を ​<code>Number</code>​ 値に変換します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-tonumberornull" class="xref page">toNumberOrNull</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">変換する特定の値と一致する最初の ​<code>Formatter</code>​ を使用して、​<code>String</code>​ 値を ​<code>Number</code>​ 値に変換します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-toperiod" class="xref page">toPeriod</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code>​ 値を ​<code>Period</code>​ 値に変換します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-toregex" class="xref page">toRegex</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code>​ 値を ​<code>Regex</code>​ 値に変換します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-tostring" class="xref page">toString</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Number</code>​ 値 (整数または小数) を ​<code>String</code>​ 値に変換し、形式、ロケール、丸めモード値を受け入れる ​<code>toString</code>​ のバリエーション。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-totime" class="xref page">toTime</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">変換する特定の値に一致する最初の​<code>フォーマッター</code>​を使用して、​<code>String</code>​ 値を ​<code>Time</code>​ 値に変換します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-totimeornull" class="xref page">toTimeOrNull</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">変換する特定の値に一致する最初の​<code>フォーマッター</code>​を使用して、​<code>String</code>​ 値を ​<code>Time</code>​ 値に変換します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-totimezone" class="xref page">toTimeZone</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code>​ 値を ​<code>TimeZone</code>​ 値に変換します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-touri" class="xref page">toUri</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>String</code>​ 値を ​<code>Uri</code>​ 値に変換します。</p></td>
</tr>
</tbody>
</table>

## [](#型)型

- [Coercions 型](https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-types)