---
schema_version: "1"
id: e02b38864d636e08e422cf27f9c6812578dcc0cf0e2c0a41c6435c12e7efe60c
title: appendIfMissing
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.6/dw-strings-functions-appendifmissing.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.6/dw-strings-functions-appendifmissing
source_site: docs.mulesoft.com
content_type: documentation
content_hash: cc15804bc5ee064b50c54de9a00d864a2dbaee70852ca6d7b4783b915cb58c98
description: MuleSoft Documentation Site
release: "2.6"
latest: false
---
# appendIfMissing

## [](#appendifmissing1)appendIfMissing(text: String, suffix: String): String

`text`​ が ​`suffix`​ で終了していない場合、​`text`​ の末尾に ​`suffix`​ を追加します。

_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>suffix</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">サフィックスとして使用するテキスト。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

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

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

```DataWeave
%dw 2.0
import appendIfMissing from dw::core::Strings
output application/json
---
{
  "a": appendIfMissing(null, ""),
  "b": appendIfMissing("abc", ""),
  "c": appendIfMissing("", "xyz") ,
  "d": appendIfMissing("abc", "xyz") ,
  "e": appendIfMissing("abcxyz", "xyz")
}
```

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

```JSON
{
  "a": null,
  "b": "abc",
  "c": "xyz",
  "d": "abcxyz",
  "e": "abcxyz"
}
```

## [](#appendifmissing2)appendIfMissing(text: Null, suffix: String): Null

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

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