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/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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file textcase-0.3.0.tar.gz.
File metadata
- Download URL: textcase-0.3.0.tar.gz
- Upload date:
- Size: 46.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6b3ab1586b1372713b53f26222ac339e12466bead5f35821dcb479bc306f23d
|
|
| MD5 |
58e559497e1f9980e5315adeae998aa6
|
|
| BLAKE2b-256 |
e6bb0018a3e0713efa011e68ee63ac58fde95b959b09b4116bac4abfc35e19c3
|
File details
Details for the file textcase-0.3.0-py3-none-any.whl.
File metadata
- Download URL: textcase-0.3.0-py3-none-any.whl
- Upload date:
- Size: 34.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac23cbe059fa549e9c74da18747b59cd7c3e00f721db7c63d8e302f839762ea2
|
|
| MD5 |
523f407e00645effaddee62fe141ff78
|
|
| BLAKE2b-256 |
25798d217dcdc6b86f803ff9ac7f0a336ef324aa474ac2d023614fac1a1fbfa2
|