Contact Us 1-800-596-4880

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 using the first Formatter that matches with the given value to transform.

toDateOrNull

Transforms a String value into a Date value using the first Formatter that matches with the given value to transform.

toDateTime

Transforms a String value into a DateTime value using the first Formatter that matches with the given value to transform.

toDateTimeOrNull

Transforms a String value into a DateTime value using the first Formatter that matches with the given value to transform.

toLocalDateTime

Transforms a String value into a LocalDateTime value using the first Formatter that matches with the given value to transform.

toLocalDateTimeOrNull

Transforms a String value into a LocalDateTime value using the first Formatter that matches with the given value to transform.

toLocalTime

Transforms a String value into a LocalTime value using the first Formatter that matches with the given value to transform.

toLocalTimeOrNull

Transforms a String value into a LocalTime value using the first Formatter that matches with the given value to transform.

toNumber

Transforms a String value into a Number value using the first Formatter that matches with the given value to transform.

toNumberOrNull

Transforms a String value into a Number value using the first Formatter that matches with the given value to transform.

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 using the first Formatter that matches with the given value to transform.

toTimeOrNull

Transforms a String value into a Time value using the first Formatter that matches with the given value to transform.

toTimeZone

Transform a String value into a TimeZone value.

toUri

Transforms a String value into a Uri value.