---
schema_version: "1"
id: 5aa4eb3bfbba08a95c5426f2ece6d01ccd99396e0e6db58f25753e4c75cac687
title: dasherize
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.11/dw-strings-functions-dasherize.md
canonical_url: https://docs.mulesoft.com/dataweave/2.11/dw-strings-functions-dasherize
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 1ea2c6b7b58cd7b116ce5567dc207165b7ecb054408b4c3ef84e407192531576
description: MuleSoft Documentation Site
release: "2.11"
latest: false
---
---
product: DataWeave
version: 2.11
---

# dasherize

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

## dasherize(text: String): String

Replaces spaces, underscores, and camel-casing in a string with dashes (hyphens).

If no spaces, underscores, and camel-casing are present, the output will match the input.

### 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 replaces the spaces, underscores, and camel-casing in the input. Notice that the input
"customer" is not modified in the output.

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Strings
output application/json
---
{
  "a" : dasherize("customer"),
  "b" : dasherize("customer_first_name"),
  "c" : dasherize("customer NAME"),
  "d" : dasherize("customerName")
}
```

#### Output

```JSON
{
  "a": "customer",
  "b": "customer-first-name",
  "c": "customer-name",
  "d": "customer-name"
}
```

## dasherize(text: Null): Null

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