---
schema_version: "1"
id: 205221dafcfe6ec4467c27a4078b2918d935e22d27ba2eabeb0683f5e7e70045
title: isWhitespace
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.9/dw-strings-functions-iswhitespace.md
canonical_url: https://docs.mulesoft.com/dataweave/2.9/dw-strings-functions-iswhitespace
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 766d4b659f6e1c1a6f80e50733cb0d6159c5ce10b265bdae7a0394b9365e90a4
description: MuleSoft Documentation Site
release: "2.9"
latest: false
---
---
product: DataWeave
version: 2.9
---

# isWhitespace

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## isWhitespace(text: String): Boolean

Checks if the `text` contains only whitespace.

_Introduced in DataWeave version 2.2.0._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>text</code></p></td><td><p>The input string.</p></td></tr></tbody></table>

### Example

This example shows how `isWhitespace` behaves with different inputs and sizes.

#### Source

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

#### Output

```JSON
{
  "a": false,
  "b": true,
  "c": true,
  "d": false,
  "e": false,
  "f": false
}
```

## isWhitespace(text: Null): Boolean

Helper function that enables `isWhitespace` to work with a `null` value.

_Introduced in DataWeave version 2.2.0._
