Documentation

hex.uint() function

The hex.uint() function is a user-contributed function maintained by the package author and can be updated or removed at any time.

hex.uint() converts a hexadecimal string representation of a number to an unsigned integer.

import "contrib/bonitoo-io/hex"

hex.uint(v: "4d2")

// Returns 1234

Parameters

v

Value to convert.

Examples

Convert a hexadecimal string to an unsigned integer

import "contrib/bonitoo-io/hex"

hex.uint(v: "-d431")

// Returns -54321

Convert all hexadecimal string values in a column to unsigned integers

  1. Use map() to iterate over and update all input rows.
  2. Use hex.uint() to update the value of a column.

The following example uses data provided by the sampledata package.

import "contrib/bonitoo-io/hex"
import "sampledata"

data =
    sampledata.uint()
        |> map(fn: (r) => ({r with _value: hex.string(v: r._value)}))

data
    |> map(fn: (r) => ({r with _value: hex.uint(v: r._value)}))

View input and output

Package author and maintainer

Github: @bonitoo-io, @sranka
InfluxDB Slack: @sranka


Was this page helpful?

Thank you for your feedback!


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.