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

# capitalize

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

## capitalize(text: String): String

Capitalizes the first letter of each word in a string.

The function treats every non-alphabetic character as a separator and replaces underscores with
spaces. For example, `capitalize("a*s_b’s")` results in `"A*S B’S"`.

### 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 string to capitalize.</p></td></tr></tbody></table>

### Example

This example capitalizes a set of strings.

#### Source

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

#### Output

```JSON
{
  "a": "Customer",
  "b": "Customer First Name",
  "c": "Customer Name",
  "d": "Customer Name",
  "e": "A*S B’S"
}
```

## capitalize(text: Null): Null

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