Skip to main content

A string case conversion package.

Project description

Case Converter

A python package for converting string cases.

General usage

You can import a case conversion helper function, or the conversion object itself.

from caseconverter import camel_case, Camel

camel_case("Hello, world!") # helloWorld
Camel("Hello, world!").convert() # helloWorld

Customizing delimiters

There are a set of default delimiters used to denote a character boundary. These delimiters are defined in caseconverter.py as DELIMITER.

from caseconverter import camel_case

# Use a pipe `|` as the only delimiter.
camel_case("Hello,|world!", delims="|") # helloWorld

Stripping punctuation

Generally, punctuation is stripped when doing a case conversion. However, should you wish to keep the punctuation you can do so by passing strip_punctuation=False.

from caseconverter import camel_case

camel_case("Hello, world!", strip_punctuation=False) # hello,World!

Available conversions

Camel case

Hello, world! => helloWorld

Pascal case

Hello, world! => HelloWorld

Snake case

Hello, world! => hello_world

Flat case

Hello, world! => helloworld

Kebab case

Hello, world! => hello-world

Cobol case

Hello, world! => HELLO-WORLD

Macro case

Hello, world! => HELLO_WORLD

Contributing

  1. Write clean code.
  2. Write new tests for new use-cases.
  3. Test your code before raising a PR.
  4. Use black to format your code.

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

Case Converter-0.0.1.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

Case_Converter-0.0.1-py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 3

Supported by

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