Metadata-Version: 2.4
Name: boolean-string-integer-parser
Version: 0.1.2
Summary: Can convert strings and numbers to boolean
Author-email: David Ivanov <davidivanov.2413@mail.ru>
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# bool-converter

A lightweight Python library to easily convert strings and integers into boolean values.

## Installation

You can install the library from PyPI using pip:

```bash
pip install boolean-string-integer-parser
```

## Usage

First, import the functions into your Python script:

```python
from booleanParser import parse_string, parse_int
```

### 1. Parsing Strings

The `parse_string` function converts specific string values to a boolean. It is case-insensitive and ignores extra spaces.

* Returns `True` if you pass: `"true"`, `"yes"`, or `"on"` (e.g., `"True"`, `"YES"`, `"On"`).
* Returns `False` for any other string.

```python
print(parse_string("true"))  # Returns: True
print(parse_string("YES"))   # Returns: True
print(parse_string("on"))    # Returns: True
print(parse_string("hello")) # Returns: False
```

### 2. Parsing Integers

The `parse_int` function strictly converts integers `1` and `0` to their respective boolean values.

* Returns `True` if the input is `1`.
* Returns `False` if the input is `0`.
* Returns `None` if the input is any other number.

```python
print(parse_int(1))   # Returns: True
print(parse_int(0))   # Returns: False
print(parse_int(5))   # Returns: None
print(parse_int(-1))  # Returns: None
```

## License

This project is licensed under the MIT License - see the LICENSE file for details.
