Python String Utils: Overview
This is a handy library to validate, manipulate and generate strings, which is:
Simple and “pythonic”
Fully documented and with examples!
100% code coverage!
Tested against all officially supported Python versions: 3.5, 3.6, 3.7, 3.8.
Fast (mostly based on compiled regex)
Free from external dependencies
PEP8 compliant
Installing
>>> pip install python-string-utils
Checking installed version
>>> import string_utils
>>> string_utils.__version__
>>> '1.0.0' # (if '1.0.0' is the installed version)
Library structure
The library basically consists in the python package string_utils, containing the following modules:
validation.py (contains string check api)
manipulation.py (contains string transformation api)
generation.py (contains string generation api)
errors.py (contains library-specific errors)
_regex.py (contains compiled regex FOR INTERNAL USAGE ONLY)
Plus a secondary package tests which includes several submodules. Specifically one for each test suite and named according to the api to test (eg. tests for is_ip() will be in test_is_ip.py and so on). All the public API are importable directly from the main package string_utils, so this:
>>> from string_utils.validation import is_ip
can be simplified as:
>>> from string_utils import is_ip
Modules
- String Validation
contains_html()
is_camel_case()
is_credit_card()
is_decimal()
is_email()
is_full_string()
is_integer()
is_ip()
is_ip_v4()
is_ip_v6()
is_isbn()
is_isbn_10()
is_isbn_13()
is_isogram()
is_json()
is_number()
is_palindrome()
is_pangram()
is_slug()
is_snake_case()
is_string()
is_url()
is_uuid()
words_count()
- String Manipulation
- String Generation
- Errors