fromHex

fromHex(hexText: String): Number

Transforms a hexadecimal number into decimal number.

Introduced in DataWeave version 2.2.0.

Parameters

Name Description

hexText

The hexadecimal number represented in a String.

Example

This example shows how the toBinary behaves with different inputs.

Source

%dw 2.0
import fromHex from dw::core::Numbers
output application/json
---
{
    a: fromHex("-1"),
    b: fromHex("3e3aeb4ae1383562f4b82261d969f7ac94ca4000000000000000"),
    c: fromHex(0),
    d: fromHex(null),
    e: fromHex("f"),
}

Output

{
  "a": -1,
  "b": 100000000000000000000000000000000000000000000000000000000000000,
  "c": 0,
  "d": null,
  "e": 15
}

fromHex(hexText: Null): Null

Helper function that enables fromHex to work with null value.

Introduced in DataWeave version 2.2.0.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub