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.3.tar.gz
(6.9 kB
view details)
Built Distribution
File details
Details for the file textcase-0.4.3.tar.gz
.
File metadata
- Download URL: textcase-0.4.3.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 |
1900dda7d5fc8cf44c414677b9be8b66b2354d9ff4107934ed577f11c1d1210a
|
|
MD5 |
deb7cb75726c6991520bdf9b77e8579a
|
|
BLAKE2b-256 |
75e65499333512a7008cfe795c4e2db404c34c61da3446727b31bfd2fcf79783
|
File details
Details for the file textcase-0.4.3-py3-none-any.whl
.
File metadata
- Download URL: textcase-0.4.3-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 |
2f1a1c069ba60e224455ae6d45ca35344ad6a2ffffd05d6bd8161c0c34515f30
|
|
MD5 |
3dacd0e241cb09135c957d0c8ebf136d
|
|
BLAKE2b-256 |
a0a37e8d624362ca16a51df435d14c08e07adf266c27d16fad422f954a3abbbd
|