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
- Convert all hexadecimal string values in a column to unsigned integers
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
- Use
map()
to iterate over and update all input rows. - 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)}))
Package author and maintainer
Github: @bonitoo-io, @sranka
InfluxDB Slack: @sranka
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, use the following resources:
InfluxDB Cloud customers can contact InfluxData Support.