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

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