Skip to main content

Detection and conversion between letter cases

Project description

Lettercase

CircleCI PyPI

A Python library for detecting and converting between various letter cases.

Supported cases:

  • snake_case
  • SCREAMING_SNAKE_CASE
  • Darwin_Case
  • dromedaryCase
  • PascalCase

Installation

Using pip

pip install lettercase

Usage

The basic usage of the library is pretty straight-forward.

To simply convert a string to another case:

>>> import lettercase

>>> lettercase.convert_to("helloWorld", "snake")
hello_world

To detect the case, use the detect_case function which returns a set of all possible cases for the given string.

>>> import lettercase

>>> lettercase.detect_case("helloWorld")
{LetterCase.DROMEDARY}

By default the function only checks as much of the string as is necessary to get a unique match, however, if you need to make sure that the letter case is correct for the entire string, you can pass fast_return=False.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for lettercase, version 0.3.2
Filename, size File type Python version Upload date Hashes
Filename, size lettercase-0.3.2-py3-none-any.whl (11.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size lettercase-0.3.2.tar.gz (7.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page