# Parse int

## Description

This operation parses a string and returns an integer of the specified base (or radix).

In a positional numeral system, the base is the number of unique digits, including the digit zero, used to represent numbers. For example, for the decimal system, the radix is ten, because it uses the ten digits from 0 through 9.

In any standard positional numeral system, a number is conventionally written as (*x*)*y* with *x* as the string of digits and *y* as its base. However, for base ten the subscript is usually assumed (and omitted, together with the pair of parentheses), as it is the most common way to express value. For example, (100)10 is equivalent to 100 (the decimal system is implied in the latter) and represents the number one hundred, while (100)2 (in the binary system with base 2) represents the number four.

Commonly used numeral systems include:

* `2` - Binary numeral system
* `8` - Octal system
* `10` - Decimal system
* `12` - Duodecimal (dozenal) system
* `16` - Hexadecimal system
* `20` - Vigesimal system
* `36` - Base36
* `60` - Sexagesimal system

***

## Data types

These are the input/output expected data types for this operation:

### Input data

![](https://965373739-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkxZeV4nlXcIAjMGZxzLI%2Fuploads%2FExtApHuiMxiHgaNWDLb2%2Fimage.png?alt=media\&token=5f4e1372-a2db-4d7e-b81b-976507cac896) - Strings you want to parse.

### Output data

![](https://965373739-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkxZeV4nlXcIAjMGZxzLI%2Fuploads%2FhmYQWGiMcgSXIYsA8jQ9%2Fimage.png?alt=media\&token=59f4d9f7-c579-4661-bf74-5ff927c02c34) - Integers after applying the specified base.

***

## Parameters

These are the parameters you need to configure to use this operation (mandatory parameters are marked with a <mark style="color:red;">**\***</mark>):

<details>

<summary>Base<mark style="color:red;"><strong>*</strong></mark></summary>

An integer between `2` and `36` that represents the string's base.

If it's nonzero and outside the range `2-36`, the operation will always fail.&#x20;

If the base argument is `0`, the true base is implied by the string's prefix with leading whitespace and possible `+`/`-` signs removed:&#x20;

* `2` for `0b`.
* `8` for `0` or `0o`.
* `16` for `0x`.
* and `10` otherwise.

For example, if your string is `0b100` and you enter `0` as **Base**, the operation will assume that the true base is `2`.

</details>

***

## Example

Suppose you want to **parse** a series of strings and convert them to integers according to a specific base:

1. In your Pipeline, open the required [Action](https://docs.onum.com/the-workspace/pipelines/actions) configuration and select the input **Field**.
2. In the **Operation** field, choose **Parse int**.
3. Set **Base** to `2`.
4. Give your **Output field** a name and click **Save**. The strings in your input field will be parsed according to the specified base. In this example:

```
100(2) -> 4
```

{% hint style="info" %}
You can try out operations with specific values using the **Input** field above the operation. You can enter the value in the example above and check the result in the **Output** field.
{% endhint %}
