Coercions (dw::util::Coercions)

This utility module assists with type coercions.

To use this module, you must import it to your DataWeave code, for example, by adding the line import * from dw::util::Coercions to the header of your DataWeave script.

Introduced in DataWeave version 2.4.0.

Functions

Name Description

toArray

Splits a String value into an Array of characters.

toBinary

Transform a String value into a Binary value using the specified encoding.

toBoolean

Transform a String value into a Boolean value.

toDate

Transforms a String value into a Date value and accepts a format and locale.

toDateTime

Transforms a Number value into a DateTime value using milliseconds or seconds as the unit.

toLocalDateTime

Transforms a String value into a LocalDateTime value and accepts a format and locale.

toLocalTime

Transforms a String value into a LocalTime value and accepts a format and locale.

toNumber

A variant of toNumber that transforms a DateTime value into a number of seconds or milliseconds, depending on the selected unit.

toPeriod

Transform a String value into a Period value.

toRegex

Transforms a String value into a Regex value.

toString

A variant of toString that transforms a Number value (whole or decimal) into a String value and accepts a format, locale, and rounding mode value.

toTime

Transforms a String value into a Time value and accepts a format and locale.

toTimeZone

Transform a String value into a TimeZone value.

toUri

Transforms a String value into a Uri value.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub