Formatting

◷ Reading Time: 2 minutes

format

Binds values of execution context to a parameterized string value. Parameters in the string should be between { and }.

input |format (ncv)

Example:

Sample: 'hello {name}'|format () 
Result: hello arash
        The assumption is that there is a name parameter in the logic which has a value of arash
Sample: '{name} is cool!'|format ({name:'FlexRule'}) 
Result: FlexRule is cool!

formatDate

Format a date to a string value with a specific display format.

input |formatDate (format)

Below are the list of formatters that can be used:

  • year: y yy yyy yyyy
  • month: M MM MMM MMMM
  • day: d dd ddd dddd
  • hour: h hh H HH
  • minute: m mm
  • second: s ss
  • AM/PM: t tt

Example:

Sample: date|formatDate (dd/MM/yyyy)

formatNumber

Format a numeric value.

input |formatNumber (format)

Example:

Sample: 12323d|formatNumber (#,##.00)  
Result: 12,323.00
Updated on July 26, 2019

Was this article helpful?

Related Articles