Python library for text case conversions.
Project description
textcase
Python library for text case conversions.
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: extend the library with custom word boundaries and cases.
- Accurate: handles any word boundaries in strings including acronyms (as in
"HTTPRequest"
). - Non-ASCII Support: handles non-ASCII characters seamlessly (no inferences on the input language itself is made).
- Tiny, Performant & Zero Dependencies: a regex-free, efficient library that stays lightweight with no external dependencies.
- 100% test coverage: every line of code is rigorously tested for reliability.
- 100% type annotated codebase: full type annotations for best developer experience.
Installation
Create and activate a virtual environment and then install textcase
:
pip install textcase
Usage
Convert a string to a text case:
import textcase
textcase.snake("Hello, world!") # hello_world
textcase.constant("Hello, world!") # HELLO_WORLD
textcase.kebab("Hello, world!") # hello-world
textcase.middot("Hello, world!") # hello·world
textcase.camel("Hello, world!") # helloWorld
textcase.pascal("Hello, world!") # HelloWorld
textcase.lower("Hello, world!") # hello world
textcase.upper("Hello, world!") # HELLO WORLD
textcase.title("Hello, world!") # Hello World
textcase.sentence("Hello, world!") # Hello world
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
textcase-0.4.2.tar.gz
(6.9 kB
view details)
Built Distribution
File details
Details for the file textcase-0.4.2.tar.gz
.
File metadata
- Download URL: textcase-0.4.2.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
8b37996d373dbfebb9c8152b1f02f118377b12de47f7ceb33a65aced470011b6
|
|
MD5 |
b375a7fb6172ffef7d6970cc81a13d72
|
|
BLAKE2b-256 |
9548222eb216b979b2e6c72d65f9bd1abb9067d36e4868e07dbe1ffaff5b07b3
|
File details
Details for the file textcase-0.4.2-py3-none-any.whl
.
File metadata
- Download URL: textcase-0.4.2-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
ebe09f6c8222adcebcf22b46c97f28bf52508b17b5e3616e8fc1a06a119d90f4
|
|
MD5 |
378c1a932b1b5b556b2feabca2f84dc1
|
|
BLAKE2b-256 |
f6d7a1610e94d18651618d6ab1989fd01988345e65b06a7be0538a2c1bfba768
|