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

# 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.
