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

# ordinalize

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

## ordinalize(Number): String

Returns a number as an ordinal, such as `1st` or `2nd`.

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>num</code></p></td><td><p>An input number to return as an ordinal.</p></td></tr></tbody></table>

### Example

This example returns a variety of input numbers as ordinals.

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Strings
output application/json
---
{
  "a" : ordinalize(1),
  "b": ordinalize(2),
  "c": ordinalize(5),
  "d": ordinalize(103)
}
```

#### Output

```JSON
{
   "a": "1st",
   "b": "2nd",
   "c": "5th",
   "d": "103rd"
}
```

## ordinalize(Null): Null

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