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

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