D
D
Developers
Search…
Numeric Transformers
Numeric transformers can be used on the source type of Number - Int, Float or Double. Following transformers are available:

addedBy

Returns result of the addition of the source and value. value is considered Double.
  • Usage: .addedBy(value)
  • Example usage: value.addedBy(15.5)
  • Example return: 10 to 25.5

dividedBy

Returns result of the division of the source and value. value is considered Double. Note: Division by zero is handled gracefully, produces zero, and doesn't throw an error.
  • Usage: .dividedBy(value)
  • Example usage: value.dividedBy(2.5)
  • Example return: 5 to 2

multipliedBy

Returns result of multiplication of the source and value. value is considered Double.
  • Usage: .multipliedBy(value)
  • Example usage: value.multipliedBy(4)
  • Example return: 2 to 8

subtractedBy

Returns result of subtraction of the source and value. value is considered Double.
  • Usage: .subtractedBy(value)
  • Example usage: value.subtractedBy(2)
  • Example return: 25 to 23

rounded

Returns the source rounded to specified number of fractions. value must be Int.
  • Usage: .rounded(fractions)
  • Example usage: value.rounded(1)
  • Example return: 1.11 to 1 or 1.16 to 1.2

ceiled

Returns the next highest Int by rounding up the source if necessary.
  • Usage: .ceiled()
  • Example usage: value.ceiled()
  • Example return: 1.78 to 2 or -3.14 to -3

floored

Returns the next lowest Int by rounding up the source if necessary.
  • Usage: .floored()
  • Example usage: value.floored()
  • Example return: 1.78 to 1 or -3.14 to -4

absolute

Returns absolute source
  • Usage: .default(value)
  • Example usage: value.default("Empty")
  • Example return: ` toEmpty`

positive

Returns the source that is either the same if it was >0, or multiplied by -1 if it was <0.
  • Usage: .positive()
  • Example usage: value.positive()
  • Example return: -1 to 1 or 2 to -2`

negative

Returns the source that is either the same if it was <0, or multiplied by -1 if it was >0.
  • Usage: .negative()
  • Example usage: value.negative()
  • Example return: 1 to -1 or -2 to -2

formatDate

Returns formatted date. The source must be Int holding value of standard time interval since 1970 (Unix epoch time).
  • Usage: .formatDate(format)
  • Example usage: value.formatDate("YYYY-MM-DD")
  • Example return: 1587490511 to 2020-04-21
Last modified 7mo ago