Home Explore Blog CI



nushell

commands/docs/into_int.md
094d178773360129637d4d0c406fecade7b1045d98312e4100000003000009e2
---
title: into int
categories: |
  conversions
version: 0.104.0
conversions: |
  Convert value to integer.
usage: |
  Convert value to integer.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `into int` for [conversions](/commands/categories/conversions.md)

<div class='command-title'>Convert value to integer.</div>

## 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
```nu
> [[num]; ['-5'] [4] [1.5]] | into int num

```

Convert string to int
```nu
> '2' | into int
2
```

Convert float to int
```nu
> 5.9 | into int
5
```

Convert decimal string to int
```nu
> '5.9' | into int
5
```

Convert file size to int
```nu
> 4KB | into int
4000
```

Convert bool to int
```nu
> [false, true] | into int
╭───┬───╮
│ 0 │ 0 │
│ 1 │ 1 │
╰───┴───╯

```

Convert date to int (Unix nanosecond timestamp)
```nu
> 1983-04-13T12:09:14.123456789-05:00 | into int
419101754123456789
```

Convert to int from binary data (radix: 2)
```nu
> '1101' | into int --radix 2
13
```

Convert to int from hex
```nu
> 'FF' |  into int --radix 16
255
```

Convert octal string to int
```nu
> '0o10132' | into int
4186
```

Convert 0 padded string to int
```nu
> '0010132' | into int
10132
```

Convert 0 padded string to int with radix 8
```nu
> '0010132' | into int --radix 8
4186
```

Convert binary value to int
```nu
> 0x[10] | into int
16
```

Convert binary value to signed int
```nu
> 0x[a0] | into int --signed
-96
```

Chunks
d30bb3f5 (1st chunk of `commands/docs/into_int.md`)
Title: Documentation for the `into int` command in Nushell
Summary
This document describes the `into int` command in Nushell, which converts various data types (binary, boolean, datetime, duration, filesize, lists, numbers, strings, records, and tables) into integers. It details the command's signature, flags (radix, endian, signed), input/output types, and provides numerous examples demonstrating its usage with different data types and options, including converting strings, floats, file sizes, booleans, dates, and binary data to integers.