Contact Free trial Login

singularize

singularize(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(Null): Null

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

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub