Case Converter
A robust python package for transforming string cases such as Hello, world! into
helloWorld (camelcase).
General usage
from caseconverter import camelcase
camelcase("Hello, world!") # output: helloWorld
Available conversions
camelcase
from caseconverter import camelcase
camelcase("Hello, world!")
helloWorld
cobolcase
from caseconverter import cobolcase
cobolcase("Hello, world!")
HELLO-WORLD
flatcase
from caseconverter import flatcase
flatcase("Hello, world!")
helloworld
kebabcase
from caseconverter import kebabcase
kebabcase("Hello, world!")
hello-world
macrocase
from caseconverter import macrocase
macrocase("Hello, world!")
HELLO_WORLD
Additional options
delims_only : bool - Only consider delimiters as boundaries (default: False).
pascalcase
from caseconverter import pascalcase
pascalcase("Hello, world!")
HelloWorld
snakecase
from caseconverter import snakecase
snakecase("Hello, world!")
hello_world
titlecase
from caseconverter import titlecase
titlecase("Hello, world!")
Hello World
Options for all conversions
Stripping punctuation
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.
camelcase("Hello, world!", strip_punctuation=False) # output: hello,World!
Delimeter customization
Default delimiters used to denote a token boundary.
DELIMITERS = " -_"
You can pass delims to each case conversion function to specify a custom
set of delimiters.
# Use a pipe `|` as the only delimiter.
camelcase("Hello,|world!", delims="|") # output: helloWorld
Behavior
Delimiters
If multiple delimeter characters are identified next to eachother they will be considered as a single delimeter. For example, -_ contains 2 different delimeter characters and is considered a single delimeter.
Boundary definitions
| Name | Description |
|---|---|
| OnDelimeterUppercaseNext | On a delimieter, upper case the following character |
| OnDelimeterLowercaseNext | On a delimeter, lower case the following character |
| OnUpperPrecededByLowerAppendUpper | On an upper case character followed by a lower case character, append the upper case character |
| OnUpperPrecededByLowerAppendLower | On an upper case character preceeded by a lower case character append the lower case character |
| OnUpperPrecededByUpperAppendJoin | On an upper case caharacter preceeded by an upper append the join character. Join characters are context dependent. Example: macro cast join character is _ |
| OnUpperPrecededByUpperAppendCurrent | On an upper case character preceeded by an upper case character append the upper case character |
Contributing
- Write clean code.
- Write new tests for new use-cases.
- Test your code before raising a PR.
- Use black to format your code.
Metadata
Release files for case-converter 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| case_converter-1.2.0.tar.gz | 8.8 kB | Without provenance | Details for case_converter-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| case_converter-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for case_converter-1.2.0-py3-none-any.whl |
Total release size: 25.0 kB
Release files / case_converter-1.2.0.tar.gz
| Download URL | case_converter-1.2.0.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e0281ae60d4335e57300bafd61cfb3fa65734587fe9efd32f6cec1a506685c5
|
|
BLAKE2b-256 checksum How to use checksums |
8309f5b4cf1f5da361e7c6f5f5f5d8bbf313a57d01574194f84abed68447fbb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.0
|
Release files / case_converter-1.2.0-py3-none-any.whl
| Download URL | case_converter-1.2.0-py3-none-any.whl |
|---|---|
| Size | 16.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb5bc6b1e121c394a6de6526cd3f8be0f5c5817c40d32251cce28a2cf4a72d8c
|
|
BLAKE2b-256 checksum How to use checksums |
428e32a7ab1ac97de46e6a0d45b1fcfe1ad7ba9a523a6fb449662ccf39b9591e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.0
|
Security for case-converter 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.