Contact Us 1-800-596-4880

singularize

singularize(text: String): String

Converts a plural string to its singular form.

If the input is already singular (for example, "box"), the output will match the input.

Parameters

Name Description

text

The string to convert to singular form.

Example

This example converts the input string "boxes" to return "box".

Source

%dw 2.0
import * from dw::core::Strings
output application/json
---
{ "singularize" : singularize("boxes") }

Output

{ "singularize" : "box" }

singularize(text: Null): Null

Helper function that enables singularize to work with a null value.