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

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

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

_DataWeave 2.2.0 で導入されました。Mule 4.2 以降でサポートされます。_​

### [](#パラメーター)パラメーター

<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(Null, String): Null

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