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 hashes)
Built Distribution
Close
Hashes for case_converter-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac816fb4b6a215346da66cdeb51b20989ce96146641001731444314d4c414730 |
|
MD5 | 31904ba6a2be357e92860d74e99e9148 |
|
BLAKE2b-256 | 6325ddb9795201438ba5e6f88f4025a9b1ec0f0c367eef2073bc27d078904c65 |