Python String Utilities

1.0.0 · maintenance · verified Mon Apr 13

python-string-utils is a small utility library (version 1.0.0, last updated March 2020) that provides functions for string validation and manipulation. It aims to be simple, 'pythonic', fast (using compiled regex), and free from external dependencies, with 100% code coverage. Its release cadence has been infrequent, with the last major update in March 2020.

Warnings

Install

Imports

Quickstart

The quickstart demonstrates importing and using core validation and manipulation functions like `is_email`, `prettify`, and `is_full_string`. All public API functions are importable directly from the `string_utils` package.

from string_utils import is_email, prettify, is_full_string

# Example 1: Validate an email address
email = "test@example.com"
print(f"'{email}' is a valid email: {is_email(email)}")

# Example 2: Prettify a string
unprettified_string = "  unprettified string ,, like this one,will be\"prettified\" . it' s awesome! "
prettified_string = prettify(unprettified_string)
print(f"Original: '{unprettified_string}'")
print(f"Prettified: '{prettified_string}'")

# Example 3: Check for non-empty string
empty_string = ""
non_empty_string = "hello"
print(f"'{empty_string}' is a full string: {is_full_string(empty_string)}")
print(f"'{non_empty_string}' is a full string: {is_full_string(non_empty_string)}")

view raw JSON →