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-0.0.2.tar.gz
(5.9 kB
view details)
Built Distribution
File details
Details for the file case-converter-0.0.2.tar.gz
.
File metadata
- Download URL: case-converter-0.0.2.tar.gz
- Upload date:
- Size: 5.9 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 | 41ca8b2d7b46947c4ff389bad5e73b1d36ee24dd34c805084019dbce593fe57a |
|
MD5 | 5f6be04c861c5f2ec55a7882c3c7fa66 |
|
BLAKE2b-256 | 2d7fb6c2073228df777847618d7e2282d9ced126ccee69bdd3c04a0074eeccbf |
File details
Details for the file case_converter-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: case_converter-0.0.2-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac816fb4b6a215346da66cdeb51b20989ce96146641001731444314d4c414730 |
|
MD5 | 31904ba6a2be357e92860d74e99e9148 |
|
BLAKE2b-256 | 6325ddb9795201438ba5e6f88f4025a9b1ec0f0c367eef2073bc27d078904c65 |