A string case conversion package.
Project description
Case Converter
A python package for transforming string cases such as Hell, world!
into
camel case, helloWorld
.
General usage
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
- Write clean code.
- Write new tests for new use-cases.
- Test your code before raising a PR.
- Use black to format your code.
Project details
Release history Release notifications | RSS feed
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-1.0.1.tar.gz
(6.2 kB
view details)
Built Distribution
File details
Details for the file case-converter-1.0.1.tar.gz
.
File metadata
- Download URL: case-converter-1.0.1.tar.gz
- Upload date:
- Size: 6.2 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbdf4ed726893edd134f8213740a0010e2ac5afae4f5f550666cec95d0170a22 |
|
MD5 | f168fbecc0e52ca0b513e628ad1df647 |
|
BLAKE2b-256 | be18529d64767aefd3bebd60af6119a87b9d3d579e075bc6f880b67d6425afaf |
File details
Details for the file case_converter-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: case_converter-1.0.1-py3-none-any.whl
- Upload date:
- Size: 7.3 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9eddac55064f9ed941402a83f9d4569653432c3ed33baa5f92cbc2b7ae08600a |
|
MD5 | c81e4910a16989fd9718a4cb6ec5806d |
|
BLAKE2b-256 | 697f90fd5b0554e1c67044bf188b101f5a5a94e1d8721ef8d135fba963ce6ef6 |