---
schema_version: "1"
id: 9568d9eb60ab23f4a1e785ebf87dc2b098ef00c8bd674003809e85aa5605b858
title: toBinary
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.8/dw-numbers-functions-tobinary.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.8/dw-numbers-functions-tobinary
source_site: docs.mulesoft.com
content_type: documentation
content_hash: a256300879802d88073f4f2d4e60d36595346602d884eab188a70f1d7b4f70bc
description: MuleSoft Documentation Site
release: "2.8"
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 で導入されました。_