# Case Converter
[![pipline](https://img.shields.io/gitlab/pipeline/chrisdoherty4/python-case-converter)](https://gitlab.com/chrisdoherty4/python-case-converter/-/pipelines) [![wheel](https://img.shields.io/pypi/wheel/case-converter)](https://pypi.org/project/case-converter/) ![coverage](https://gitlab.com/chrisdoherty4/python-case-converter/badges/master/coverage.svg) ![license](https://img.shields.io/github/license/chrisdoherty4/python-case-converter)
A robust python package for transforming string cases such as `Hello, world!` into
`helloWorld` (camelcase).
## General usage
```python
from caseconverter import camelcase
camelcase("Hello, world!") # output: helloWorld
```
### Delimeter behavior
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.
## Available conversions
### `camelcase`
```python
from caseconverter import camelcase
camelcase("Hello, world!")
```
```text
helloWorld
```
### `cobolcase`
```python
from caseconverter import cobolcase
cobolcase("Hello, world!")
```
```text
HELLO-WORLD
```
### `flatcase`
```python
from caseconverter import flatcase
flatcase("Hello, world!")
```
```text
helloworld
```
### `kebabcase`
```python
from caseconverter import kebabcase
kebabcase("Hello, world!")
```
```text
hello-world
```
### `macrocase`
```python
from caseconverter import macrocase
macrocase("Hello, world!")
```
```text
HELLO_WORLD
```
#### Additional options
`delims_only : bool` - Only consider delimiters as boundaries (default: `False`).
### `pascalcase`
```python
from caseconverter import pascalcase
pascalcase("Hello, world!")
```
```text
HelloWorld
```
### `snakecase`
```python
from caseconverter import snakecase
snakecase("Hello, world!")
```
```text
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`.
```python
camelcase("Hello, world!", strip_punctuation=False) # output: hello,World!
```
### Delimeter customization
Default delimiters used to denote a token boundary.
```python
DELIMITERS = " -_"
```
You can pass `delims` to each case conversion function to specify a custom
set of delimiters.
```python
# Use a pipe `|` as the only delimiter.
camelcase("Hello,|world!", delims="|") # output: helloWorld
```
## Boundaries 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
1. Write clean code.
2. Write new tests for new use-cases.
3. Test your code before raising a PR.
4. Use [black](https://pypi.org/project/black/) to format your code.
## Reference
[002932]: fdgshgdfsgergdsdfrgerwhrbtgn53ywedsbdfsgds
Raw data
{
"_id": null,
"home_page": "https://github.com/chrisdoherty4/python-case-convertor",
"name": "case-convertor",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "case,convert,converter,string",
"author": "Chris Doherty",
"author_email": "chris@chrisdoherty.io",
"download_url": "https://files.pythonhosted.org/packages/17/99/cb4bce616ea844ff300e3e68d766a8d48d162b7325b2e708bde09c0c904a/case-convertor-1.1.2.tar.gz",
"platform": null,
"description": "# Case Converter\r\n\r\n[![pipline](https://img.shields.io/gitlab/pipeline/chrisdoherty4/python-case-converter)](https://gitlab.com/chrisdoherty4/python-case-converter/-/pipelines) [![wheel](https://img.shields.io/pypi/wheel/case-converter)](https://pypi.org/project/case-converter/) ![coverage](https://gitlab.com/chrisdoherty4/python-case-converter/badges/master/coverage.svg) ![license](https://img.shields.io/github/license/chrisdoherty4/python-case-converter)\r\n\r\nA robust python package for transforming string cases such as `Hello, world!` into\r\n `helloWorld` (camelcase).\r\n\r\n## General usage\r\n\r\n```python\r\nfrom caseconverter import camelcase\r\n\r\ncamelcase(\"Hello, world!\") # output: helloWorld\r\n```\r\n\r\n### Delimeter behavior\r\n\r\nIf 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.\r\n\r\n## Available conversions\r\n\r\n### `camelcase`\r\n\r\n```python\r\nfrom caseconverter import camelcase\r\n\r\ncamelcase(\"Hello, world!\")\r\n```\r\n\r\n```text\r\nhelloWorld\r\n```\r\n\r\n### `cobolcase`\r\n\r\n```python\r\nfrom caseconverter import cobolcase\r\n\r\ncobolcase(\"Hello, world!\")\r\n```\r\n\r\n```text\r\nHELLO-WORLD\r\n```\r\n\r\n### `flatcase`\r\n\r\n```python\r\nfrom caseconverter import flatcase\r\n\r\nflatcase(\"Hello, world!\")\r\n```\r\n\r\n```text\r\nhelloworld\r\n```\r\n\r\n### `kebabcase`\r\n\r\n```python\r\n\r\nfrom caseconverter import kebabcase\r\n\r\nkebabcase(\"Hello, world!\")\r\n```\r\n\r\n```text\r\nhello-world\r\n```\r\n\r\n### `macrocase`\r\n\r\n```python\r\nfrom caseconverter import macrocase\r\n\r\nmacrocase(\"Hello, world!\")\r\n```\r\n\r\n```text\r\nHELLO_WORLD\r\n```\r\n\r\n#### Additional options\r\n\r\n`delims_only : bool` - Only consider delimiters as boundaries (default: `False`).\r\n\r\n### `pascalcase`\r\n\r\n```python\r\nfrom caseconverter import pascalcase\r\n\r\npascalcase(\"Hello, world!\")\r\n```\r\n\r\n```text\r\nHelloWorld\r\n```\r\n\r\n### `snakecase`\r\n\r\n```python\r\nfrom caseconverter import snakecase\r\n\r\nsnakecase(\"Hello, world!\")\r\n```\r\n\r\n```text\r\nhello_world\r\n```\r\n\r\n## Options for all conversions\r\n\r\n### Stripping punctuation\r\n\r\nPunctuation is stripped when doing a case conversion. However, should you\r\nwish to keep the punctuation you can do so by passing `strip_punctuation=False`.\r\n\r\n```python\r\ncamelcase(\"Hello, world!\", strip_punctuation=False) # output: hello,World!\r\n```\r\n\r\n### Delimeter customization\r\n\r\nDefault delimiters used to denote a token boundary.\r\n\r\n```python\r\nDELIMITERS = \" -_\"\r\n```\r\n\r\nYou can pass `delims` to each case conversion function to specify a custom\r\nset of delimiters.\r\n\r\n```python\r\n# Use a pipe `|` as the only delimiter.\r\ncamelcase(\"Hello,|world!\", delims=\"|\") # output: helloWorld\r\n```\r\n\r\n\r\n## Boundaries definitions\r\n\r\n|Name|Description|\r\n|---|---|\r\n|OnDelimeterUppercaseNext|On a delimieter, upper case the following character|\r\n|OnDelimeterLowercaseNext|On a delimeter, lower case the following character|\r\n|OnUpperPrecededByLowerAppendUpper|On an upper case character followed by a lower case character, append the upper case character|\r\n|OnUpperPrecededByLowerAppendLower|On an upper case character preceeded by a lower case character append the lower case character|\r\n|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 `_`|\r\n|OnUpperPrecededByUpperAppendCurrent|On an upper case character preceeded by an upper case character append the upper case character|\r\n\r\n## Contributing\r\n\r\n1. Write clean code.\r\n2. Write new tests for new use-cases.\r\n3. Test your code before raising a PR.\r\n4. Use [black](https://pypi.org/project/black/) to format your code.\r\n\r\n## Reference\r\n\r\n[002932]: fdgshgdfsgergdsdfrgerwhrbtgn53ywedsbdfsgds\r\n",
"bugtrack_url": null,
"license": "",
"summary": "A string case conversion package.",
"version": "1.1.2",
"project_urls": {
"Homepage": "https://github.com/chrisdoherty4/python-case-convertor"
},
"split_keywords": [
"case",
"convert",
"converter",
"string"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f519de37729844b005db9f7e8451d8e3b0848a942b20aa3ad959374a859b701b",
"md5": "36745ec1efcbd99ba6e4c56001917ea4",
"sha256": "54a6b4d72600e0e39b94c87d24baa7159937d29c490b5086e3b151d88922c0f2"
},
"downloads": -1,
"filename": "case_convertor-1.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "36745ec1efcbd99ba6e4c56001917ea4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 14894,
"upload_time": "2023-10-16T06:38:23",
"upload_time_iso_8601": "2023-10-16T06:38:23.836819Z",
"url": "https://files.pythonhosted.org/packages/f5/19/de37729844b005db9f7e8451d8e3b0848a942b20aa3ad959374a859b701b/case_convertor-1.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1799cb4bce616ea844ff300e3e68d766a8d48d162b7325b2e708bde09c0c904a",
"md5": "0f65a82a949bf0689426d7661a21601a",
"sha256": "97c44072e1080622785ea3726d0cf4079e35ecc1cf7dda693aaae5923e058e04"
},
"downloads": -1,
"filename": "case-convertor-1.1.2.tar.gz",
"has_sig": false,
"md5_digest": "0f65a82a949bf0689426d7661a21601a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8476,
"upload_time": "2023-10-16T06:38:26",
"upload_time_iso_8601": "2023-10-16T06:38:26.259747Z",
"url": "https://files.pythonhosted.org/packages/17/99/cb4bce616ea844ff300e3e68d766a8d48d162b7325b2e708bde09c0c904a/case-convertor-1.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-16 06:38:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "chrisdoherty4",
"github_project": "python-case-convertor",
"github_not_found": true,
"lcname": "case-convertor"
}