---
schema_version: "1"
id: aa97d6857af48515ff0e951e1841e36b562dff81c6e28a43cd7968d225ae74cf
title: rightPad
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.5/dw-strings-functions-rightpad.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.5/dw-strings-functions-rightpad
source_site: docs.mulesoft.com
content_type: documentation
content_hash: f6adc153faa378be08b994b7e8806c7f395a5cadddc01a06aa4746768b7051d6
description: MuleSoft Documentation Site
release: "2.5"
latest: false
---
# rightPad

## [](#rightpad1)rightPad(text: String, size: Number, padChar: String = " "): String

目的のサイズ (​`size`​) になるように、指定された ​`text`​ の​_右_​側に ​`padText`​ を埋め込みます。 デフォルトの ​`padText`​ は ​`" "`​ です。

右側をパディングした ​`String`​ を返すか、パディングが不要な場合は元の ​`String`​ を返します。

_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>text</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>size</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>padText</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">埋め込むテキスト。指定されていない場合、デフォルトで 1 桁の空白に設定されます。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、さまざまな入力とサイズでの ​`rightPad`​ の動作を示します。

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

```DataWeave
%dw 2.0
import * from dw::core::Strings
output application/json
---
{
  "a": rightPad(null, 3),
  "b": rightPad("", 3),
  "c": rightPad("bat", 5),
  "d": rightPad("bat", 3),
  "e": rightPad("bat", -1)
}
```

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

```JSON
{
  "a": null,
  "b": "   ",
  "c": "bat  ",
  "d": "bat",
  "e": "bat"
}
```

## [](#rightpad2)rightPad(text: Null, size: Any, padText: Any = " "): Null

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

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