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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file Case Converter-0.0.1.tar.gz.

File metadata

  • Download URL: Case Converter-0.0.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for Case Converter-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8f3f629758fe4cbde605cdc95856c56a9464da87863fb76042dc2b8e3c24ca79
MD5 58f57dfe38c1306dd0599e1a0bf3fe19
BLAKE2b-256 bc6f0cba4f21baeaea5812c80a9240cfffe16a9a4194aa22f8b49ba2d4c49d8f

See more details on using hashes here.

File details

Details for the file Case_Converter-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: Case_Converter-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for Case_Converter-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f302b5c7d30536fe23c2182057fea32395883432310332c0f6029d61d87d8c44
MD5 e44507c3557e467817c5762fbfb3b2dd
BLAKE2b-256 f47fc9c3fcd01248d4da60393d5d157e9aed32c6860cf669c2190b7e69288be3

See more details on using hashes here.

Supported by

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