Message format
Syntax
messageFormat($pattern)
Description
Constructs a message format with the given pattern for either parse() or format() calls.
See MessageFormat.
Parameters
Name | Type | Description | Mandatory | Default |
---|---|---|---|---|
pattern | String |
The pattern in which to format. Placeholders can be defined ( |
yes |
Return value
Type: Business object
A message format that can now be used for parse() or format() calls.
Examples
Simple formatting
messageFormat("Good {0}, {1}! Today we have {2} degrees.").format("Morning", "Sir", 19)
Output: Good Morning Sir! Today we have 19 degrees.
Format with format type
messageFormat("At {1,time} on {1,date}, there was {2} on planet {0,number,integer}.").format(7, now(), "a disturbance in the Force")
Output: At 15:36:40 on 11.10.2021, there was a disturbance in the Force on planet 7.
The date is used multiple times in this message and formatted accordingly using time and date.
Parse
messageFormat("Good {0}!").parse("Good Morning!")
Output: Message object