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

# ordinalize

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

## ordinalize(num: 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(num: Null): Null

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