W3cubDocs

/Nushell

into int for conversions

Convert value to integer.

Signature

> into int {flags} ...rest

Flags

  • --radix, -r {number}: radix of integer
  • --endian, -e {string}: byte encode endian, available options: native(default), little, big

Parameters

  • ...rest: for a data structure input, convert data at the given cell paths

Input/output types:

input output
binary int
bool int
datetime int
duration int
filesize int
list<any> list<int>
list<bool> list<int>
list<datetime> list<int>
list<duration> list<int>
list<filesize> list<int>
list<number> list<int>
list<string> list<int>
number int
record record
string int
table table

Examples

Convert string to integer in table

> [[num]; ['-5'] [4] [1.5]] |into intnum

Convert string to integer

>'2'|into int
2

Convert float to integer

>5.9|into int
5

Convert decimal string to integer

>'5.9'|into int
5

Convert file size to integer

>4KB|into int
4000

Convert bool to integer

> [false, true] |into int
╭───┬───╮
00
11
╰───┴───╯

Convert date to integer (Unix nanosecond timestamp)

>1983-04-13T12:09:14.123456789-05:00|into int
419101754123456789

Convert to integer from binary

>'1101'|into int-r2
13

Convert to integer from hex

>'FF'|into int-r16
255

Convert octal string to integer

>'0o10132'|into int
4186

Convert 0 padded string to integer

>'0010132'|into int
10132

Convert 0 padded string to integer with radix

>'0010132'|into int-r8
4186

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/into_int.html