Skip to main content

Handy string utilities for Python

Project description

PyStringToolkit

PyPI version PyPI Downloads License: MIT Contributions welcome

PyStringToolkit is a lightweight and intuitive Python library offering a rich set of utilities for string manipulation and transformation. Whether you're building web applications, preprocessing text for machine learning, or just want cleaner and more readable code — this toolkit simplifies the process with clean and reusable functions.


✨ Key Features

🔠 Case Conversion Utilities

Transform strings between common naming conventions:

  • to_snake_case() → Converts text to snake_case
  • to_camel_case() → Converts text to camelCase
  • to_pascal_case() → Converts text to PascalCase
  • to_kebab_case() → Converts text to kebab-case
  • to_upper_case() → Converts all letters to uppercase
  • to_lower_case() → Converts all letters to lowercase
  • to_title_case() → Capitalizes the first letter of each word
  • to_alternating_case() → alternates uppercase and lowercase characters in a string

🧹 Text Cleaning Functions

Remove unwanted characters and normalize formatting:

  • remove_punctuation() → Strips punctuation, preserving only letters and digits
  • remove_whitespaces() → Removes all whitespaces from the string
  • remove_extra_spaces() → Reduces multiple spaces to a single space
  • truncate(length) → Cuts off text after a specified length, adding ellipsis
  • contains_only_alpha() → Checks if the string contains only alphabetic characters
  • strip_html_tags() -> remove any HTML tags in a string

🔧 String Generation Tools

Helpful tools for generating and formatting text:

  • slugify() → Converts text into URL-friendly slugs ("Hello World!" → "hello-world")
  • random_string(length) → Generates a random alphanumeric string of a given length

📧 Validators

  • is_email() → function validates if a string is a properly formatted email address

📦 Installation

Install the latest version via pip:

pip install pystringtoolkit

Example

from pystringtoolkit import to_snake_case

print(to_snake_case("Hello World!"))  # hello_world

Contribution guide

You can find the contribution guide here to contribute in this project. Contribution Guide Thanks

Documentation

Full documentation is available here 👉 PyStringToolkit Docs

The docs include:

  • Installation guide
  • Usage patterns & best practices

Contributors

We value our contributors!

All the people who help improve PyStringToolkit are listed in CONTRIBUTORS.md.

A huge thanks to everyone — whether it’s code, docs, tests, or ideas 🙌

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pystringtoolkit-0.1.4.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pystringtoolkit-0.1.4-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file pystringtoolkit-0.1.4.tar.gz.

File metadata

  • Download URL: pystringtoolkit-0.1.4.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for pystringtoolkit-0.1.4.tar.gz
Algorithm Hash digest
SHA256 2c39dc23e7ff4f92dabd3f97ae44fb9e4ff9adb1bb0e639176e7d9334c854a8b
MD5 9a2f9824de40760a8b37df6848506520
BLAKE2b-256 cfb51d59ffcb9c82d8d332cad1e417d67d1c8d266f3b91fb2c42c15112cb4811

See more details on using hashes here.

File details

Details for the file pystringtoolkit-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for pystringtoolkit-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 301dac47ee78cc60dbc26e13c54154f17a28bc8d83263a02afebd4519db85c8b
MD5 21f451736a857266ec06eea4a999079d
BLAKE2b-256 3259f8d137f2fdef0be73c4ee1ce38dc016c6849793adb4763bc0e3a0a20468a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page