---
schema_version: "1"
id: 2425ef9599e4dd5e18e341abd88b8de73569a884a418bbcc4d23a811364de4c0
title: toBinary
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.4/dw-numbers-functions-tobinary.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.4/dw-numbers-functions-tobinary
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 253a8d938d3eea12ca76b744829205f8a5391dfbac36ef3d021d05a4c860f20d
description: MuleSoft Documentation Site
release: "2.4"
latest: false
---
# toBinary

## [](#tobinary1)toBinary(number: Number): String

10 進数を 2 進数に変換します。

_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>number</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">入力数値。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、さまざまな入力での ​`toBinary`​ の動作を示します。

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

```DataWeave
%dw 2.0
import toBinary from dw::core::Numbers
output application/json
---
{
    a: toBinary(-2),
    b: toBinary(100000000000000000000000000000000000000000000000000000000000000),
    c: toBinary(0),
    d: toBinary(null),
    e: toBinary(2),
}
```

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

```JSON
{
  "a": "-10",
  "b": "11111000111010111010110100101011100001001110000011010101100010111101001011100000100010011000011101100101101001111101111010110010010100110010100100000000000000000000000000000000000000000000000000000000000000",
  "c": "0",
  "d": null,
  "e": "10"
}
```

## [](#tobinary2)toBinary(number: Null): Null

`toBinary`​ を null 値に使用できるようにするヘルパー関数。

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