%dw 2.0
import * from dw::core::Strings
output application/json
---
{ "singularize" : singularize("boxes") }
DataWeave
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 |
---|---|
|
The string to convert to singular form. |
Example
This example converts the input string "boxes" to return "box".
Source
Output
{ "singularize" : "box" }
JSON
singularize(text: Null): Null
Helper function that enables singularize
to work with a null
value.