---
schema_version: "1"
id: 88299dd9b4d966eaafaec8f2d1699965731631056aa7ae97f9dca876c0652631
title: charCode
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.3/dw-strings-functions-charcode.md
canonical_url: https://docs.mulesoft.com/dataweave/2.3/dw-strings-functions-charcode
source_site: docs.mulesoft.com
content_type: documentation
content_hash: ecb4ae7db77a3aded242f3364aa0a260d8d694ab64a6b4e44792f23fd6358250
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
---
product: DataWeave
version: 2.3
---

# charCode

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

## charCode(String): Number

Returns the Unicode for the first character in an input string.

For an empty string, the function fails and returns `Unexpected empty string`.

### 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 returns Unicode for the "M" in "Mule".

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Strings
output application/json
---
{
  "charCode" : charCode("Mule")
}
```

#### Output

```XML
{ "charCode" : 77 }
```
