Skip to main content

A feature-rich Python text case conversion library.

Project description

textcase logo

textcase

A feature-rich Python text case conversion library.

Coveralls Dependencies PyPI - Version PyPI - Downloads PyPI - Python Version PyPI - Types PyPI - Wheel AUR Version

Documentation: https://zobweyt.github.io/textcase

PyPI: https://pypi.org/project/textcase

Features

  • Text case conversion: Convert strings between various text cases (e.g., snake_case, kebab-case, camelCase, etc.).
  • Extensible Design: Easily extend the library with custom cases and boundaries.
  • Acronym Handling: Properly detects and formats acronyms in strings (as in HTTPRequest).
  • Non-ASCII Support: Handles non-ASCII characters seamlessly (no inferences on the input language itself is made).
  • 100% Test Coverage: Comprehensive tests ensure reliability and correctness.
  • Well-Documented: Clean documentation with usage examples for easy understanding.
  • Performant: Efficient implementation without the use of regular expressions.
  • Zero Dependencies: The library has no external dependencies, making it lightweight and easy to integrate.

Installation

Create and activate a virtual environment and then install textcase:

pip install textcase

Usage

You can convert strings into a case using the convert function:

from textcase import case, convert

print(convert("ronnie james dio", case.SNAKE))     # ronnie_james_dio
print(convert("Ronnie_James_dio", case.CONSTANT))  # RONNIE_JAMES_DIO
print(convert("RONNIE_JAMES_DIO", case.KEBAB))     # ronnie-james-dio
print(convert("ronnie james dio", case.MIDDOT))    # ronnie·james·dio
print(convert("RONNIE-JAMES-DIO", case.CAMEL))     # ronnieJamesDio
print(convert("ronnie-james-dio", case.PASCAL))    # RonnieJamesDio
print(convert("RONNIE JAMES DIO", case.LOWER))     # ronnie james dio
print(convert("ronnie james dio", case.UPPER))     # RONNIE JAMES DIO
print(convert("ronnie-james-dio", case.TITLE))     # Ronnie James Dio
print(convert("ronnie james dio", case.SENTENCE))  # Ronnie james dio

See documentation for more usage examples.

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

textcase-0.3.1.tar.gz (46.3 kB view details)

Uploaded Source

Built Distribution

textcase-0.3.1-py3-none-any.whl (34.7 kB view details)

Uploaded Python 3

File details

Details for the file textcase-0.3.1.tar.gz.

File metadata

  • Download URL: textcase-0.3.1.tar.gz
  • Upload date:
  • Size: 46.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.4

File hashes

Hashes for textcase-0.3.1.tar.gz
Algorithm Hash digest
SHA256 6814a6f05b787db6938aa80d04186cafc4795232db55bb60bbec60075ea49bae
MD5 c6cb85eda274d07db4b4f113fa00ce7b
BLAKE2b-256 c7609708f35e40610558bd55703419d2ad1a8f4621843bec5c38410a575666d0

See more details on using hashes here.

File details

Details for the file textcase-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: textcase-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 34.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.4

File hashes

Hashes for textcase-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a532f24267e24ecf9302d1f440c798069f1fe4ca6686eabcea9364f5bdbfd2a9
MD5 a12c4b27b2a16c5d09a678867405a180
BLAKE2b-256 7ce74f4ee2845bb19904e160a3d86f771103b9bf69e07543ffd2f6be89cb8d61

See more details on using hashes here.

Supported by

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