Skip to main content

A feature-rich Python text case conversion library.

Project description

textcase logo

textcase

A feature-rich Python text case conversion library.

Coveralls PyPI - Version PyPI - Downloads PyPI - Python 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: extend the library with custom word boundaries and cases.
  • Accurate: finds 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


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.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

textcase-0.4.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file textcase-0.4.1.tar.gz.

File metadata

  • Download URL: textcase-0.4.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.4

File hashes

Hashes for textcase-0.4.1.tar.gz
Algorithm Hash digest
SHA256 25d81009e5e2a25a9f8ebc81cab6b366ea272c045f33f698b07883f799b7695a
MD5 c39c6a2948c05ad2fd47822d193e357b
BLAKE2b-256 3bf65555d82857fe125ac04d71781475aa7f2f9cb908d59c5e5f2d10deb324a5

See more details on using hashes here.

File details

Details for the file textcase-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: textcase-0.4.1-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

Hashes for textcase-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d03e266e77a5fb0d7cdb31882f7e5d566e0adc7934f7182a2e1ab645a1979133
MD5 ba80d24204e1ccb41ca9ab9b352a9dcd
BLAKE2b-256 238ac2772182a3b7a1e13f8b491f2cff92d0d07464576a05e14540d7b4220cd1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page