A feature-rich Python text case conversion library.
Project description
textcase
A feature-rich Python text case conversion library.
Documentation: https://zobweyt.github.io/textcase
PyPi: https://pypi.org/projects/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.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
Project details
Release history Release notifications | RSS feed
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.2.1.tar.gz
(45.1 kB
view details)
Built Distribution
textcase-0.2.1-py3-none-any.whl
(33.5 kB
view details)
File details
Details for the file textcase-0.2.1.tar.gz
.
File metadata
- Download URL: textcase-0.2.1.tar.gz
- Upload date:
- Size: 45.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
12e1356b9f3844f62e5f30b2af5ba1890e5f958095856755b236c43995a19f98
|
|
MD5 |
4bbbc866dbed38f810612a2957b8ee4f
|
|
BLAKE2b-256 |
8906fcf56336774032d3b090963a22cd2b56eb6eeff3660eac8b326ccb9b79c7
|
File details
Details for the file textcase-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: textcase-0.2.1-py3-none-any.whl
- Upload date:
- Size: 33.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
785ab5e7604b2aa1be819af7c299e54b2f5265f3e453fcbab20c8d80e832ea3d
|
|
MD5 |
2f325c8d658f37c261430e3e515cea87
|
|
BLAKE2b-256 |
01b61c6547f39fce39e82c57570e75816b7dc933d4595f16cbe710d16e090337
|