Documentation

hex.int() function

Flux 0.131.0+

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

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

import "contrib/bonitoo-io/hex"

hex.int(v: "4d2")

// Returns 1234

Parameters

v

Value to convert.

Examples

Convert a hexadecimal string to an integer

import "contrib/bonitoo-io/hex"

hex.int(v: "-d431")

// Returns -54321

Convert all hexadecimal string values in a column to integers

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

The following example uses data provided by the sampledata package.

import "sampledata"

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

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

View input and output

Package author and maintainer

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


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.