Skip to main content

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.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.

Metadata

Release files for textcase 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for textcase 0.2.2
File Size Uploaded
textcase-0.2.2.tar.gz 45.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for textcase 0.2.2
File Interpreter ABI Platform
textcase-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 80.1 kB

Release files / textcase-0.2.2.tar.gz

Download URL textcase-0.2.2.tar.gz
Size 45.9 kB
Tags Source
SHA-256 checksum
How to use checksums
187cd93fc556ae523a2d2c9c443bc2804c985fb97da5684a191df18d42054341
BLAKE2b-256 checksum
How to use checksums
9fa92942eb9f8ac8d6404410589ee90605c7fb67ceb7d9a1f77ffe05e8ed39c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.4

Release files / textcase-0.2.2-py3-none-any.whl

Download URL textcase-0.2.2-py3-none-any.whl
Size 34.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d1171bef615673cc54809ba6d47ebd8d597b39aeec633a755daf25dd2db1aaa
BLAKE2b-256 checksum
How to use checksums
8e14ec6017b8b2e0e21621b369048932d0f1fc09ba231462ff704182c1b1edda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.4

Release history Release notifications | RSS feed

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.3

2 release files

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page