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.0.tar.gz
(5.9 kB
view hashes)
Built Distribution
Close
Hashes for case_converter-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96b78ff0a9089c2567add5461f26cd0bf48deaaf8962514ce1d301841351a804 |
|
MD5 | f21624167181566d733523b0eb4ba67e |
|
BLAKE2b-256 | 136e4ae160a77f721eaac179b2d0959609b11ff06143813fb3fa9303aae6bfb2 |