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

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