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:
pip install boolean-string-integer-parser
Usage
First, import the functions into your Python script:
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
Trueif you pass:"true","yes", or"on"(e.g.,"True","YES","On"). - Returns
Falsefor any other string.
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
Trueif the input is1. - Returns
Falseif the input is0. - Returns
Noneif the input is any other number.
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.
Metadata
Release files for boolean-string-integer-parser 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| boolean_string_integer_parser-0.1.2.tar.gz | 2.1 kB | Without provenance | Details for boolean_string_integer_parser-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| boolean_string_integer_parser-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for boolean_string_integer_parser-0.1.2-py3-none-any.whl |
Total release size: 4.8 kB
Release files / boolean_string_integer_parser-0.1.2.tar.gz
| Download URL | boolean_string_integer_parser-0.1.2.tar.gz |
|---|---|
| Size | 2.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
32118d4e5bded85d0747d6723dcca46fb1bb2cacfe5e292dd04c842a705204c1
|
|
BLAKE2b-256 checksum How to use checksums |
f98e2f483600f401cc5a35420d97b2bd9d57b88bfba5e8ef629bf5ffb1fbec9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|
Release files / boolean_string_integer_parser-0.1.2-py3-none-any.whl
| Download URL | boolean_string_integer_parser-0.1.2-py3-none-any.whl |
|---|---|
| Size | 2.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c93461bc1a00e5bc7b72270255f5c32a8a7025296fc1484f3c62bed15924418a
|
|
BLAKE2b-256 checksum How to use checksums |
180d410c3c90c44a13a9de98b45dd0504ac353f7436441959d1ff277add5e799
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|
Security for boolean-string-integer-parser 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.