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--signed, -s
: always treat input number as a signed number
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 int in table
> [[num]; ['-5'] [4] [1.5]] | into int num
Convert string to int
> '2' | into int
2
Convert float to int
> 5.9 | into int
5
Convert decimal string to int
> '5.9' | into int
5
Convert file size to int
> 4KB | into int
4000
Convert bool to int
> [false, true] | into int
╭───┬───╮
│ 0 │ 0 │
│ 1 │ 1 │
╰───┴───╯
Convert date to int (Unix nanosecond timestamp)
> 1983-04-13T12:09:14.123456789-05:00 | into int
419101754123456789
Convert to int from binary data (radix: 2)
> '1101' | into int --radix 2
13
Convert to int from hex
> 'FF' | into int --radix 16
255
Convert octal string to int
> '0o10132' | into int
4186
Convert 0 padded string to int
> '0010132' | into int
10132
Convert 0 padded string to int with radix 8
> '0010132' | into int --radix 8
4186
Convert binary value to int
> 0x[10] | into int
16
Convert binary value to signed int
> 0x[a0] | into int --signed
-96