# 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.
Raw data
{
"_id": null,
"home_page": "https://github.com/chrisdoherty4/python-case-converter",
"name": "case-converter",
"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/76/d9/48a4f2bb0dbea1086836a25b64ba77f5ab23652a12f45d9bbd2fe3f13d35/case-converter-1.1.0.tar.gz",
"platform": null,
"description": "# Case Converter\n\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)\n\nA robust python package for transforming string cases such as `Hello, world!` into\n `helloWorld` (camelcase).\n\n## General usage\n\n```python\nfrom caseconverter import camelcase\n\ncamelcase(\"Hello, world!\") # output: helloWorld\n```\n\n### Delimeter behavior\n\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.\n\n## Available conversions\n\n### `camelcase`\n\n```python\nfrom caseconverter import camelcase\n\ncamelcase(\"Hello, world!\")\n```\n\n```text\nhelloWorld\n```\n\n### `cobolcase`\n\n```python\nfrom caseconverter import cobolcase\n\ncobolcase(\"Hello, world!\")\n```\n\n```text\nHELLO-WORLD\n```\n\n### `flatcase`\n\n```python\nfrom caseconverter import flatcase\n\nflatcase(\"Hello, world!\")\n```\n\n```text\nhelloworld\n```\n\n### `kebabcase`\n\n```python\n\nfrom caseconverter import kebabcase\n\nkebabcase(\"Hello, world!\")\n```\n\n```text\nhello-world\n```\n\n### `macrocase`\n\n```python\nfrom caseconverter import macrocase\n\nmacrocase(\"Hello, world!\")\n```\n\n```text\nHELLO_WORLD\n```\n\n#### Additional options\n\n`delims_only : bool` - Only consider delimiters as boundaries (default: `False`).\n\n### `pascalcase`\n\n```python\nfrom caseconverter import pascalcase\n\npascalcase(\"Hello, world!\")\n```\n\n```text\nHelloWorld\n```\n\n### `snakecase`\n\n```python\nfrom caseconverter import snakecase\n\nsnakecase(\"Hello, world!\")\n```\n\n```text\nhello_world\n```\n\n## Options for all conversions\n\n### Stripping punctuation\n\nPunctuation is stripped when doing a case conversion. However, should you\nwish to keep the punctuation you can do so by passing `strip_punctuation=False`.\n\n```python\ncamelcase(\"Hello, world!\", strip_punctuation=False) # output: hello,World!\n```\n\n### Delimeter customization\n\nDefault delimiters used to denote a token boundary.\n\n```python\nDELIMITERS = \" -_\"\n```\n\nYou can pass `delims` to each case conversion function to specify a custom\nset of delimiters.\n\n```python\n# Use a pipe `|` as the only delimiter.\ncamelcase(\"Hello,|world!\", delims=\"|\") # output: helloWorld\n```\n\n\n## Boundaries definitions\n\n|Name|Description|\n|---|---|\n|OnDelimeterUppercaseNext|On a delimieter, upper case the following character|\n|OnDelimeterLowercaseNext|On a delimeter, lower case the following character|\n|OnUpperPrecededByLowerAppendUpper|On an upper case character followed by a lower case character, append the upper case character|\n|OnUpperPrecededByLowerAppendLower|On an upper case character preceeded by a lower case character append the lower case character|\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 `_`|\n|OnUpperPrecededByUpperAppendCurrent|On an upper case character preceeded by an upper case character append the upper case character|\n\n## Contributing\n\n1. Write clean code.\n2. Write new tests for new use-cases.\n3. Test your code before raising a PR.\n4. Use [black](https://pypi.org/project/black/) to format your code.\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "A string case conversion package.",
"version": "1.1.0",
"split_keywords": [
"case",
"convert",
"converter",
"string"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b93220d0de7482c40aff9b42002b98a169adcaf0e5e50b59278e8f6405361278",
"md5": "baa12246329aac17950657d43f0c9182",
"sha256": "d0fbc665a4fd410e454630bcf5168dce62e147a98512647ed48b0a6b556986e3"
},
"downloads": -1,
"filename": "case_converter-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "baa12246329aac17950657d43f0c9182",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 14837,
"upload_time": "2022-04-16T18:13:43",
"upload_time_iso_8601": "2022-04-16T18:13:43.534938Z",
"url": "https://files.pythonhosted.org/packages/b9/32/20d0de7482c40aff9b42002b98a169adcaf0e5e50b59278e8f6405361278/case_converter-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "76d948a4f2bb0dbea1086836a25b64ba77f5ab23652a12f45d9bbd2fe3f13d35",
"md5": "bf3c3631c3d1db44a46ee589a52ad2d7",
"sha256": "2ed3fc6e3ffa8d601f9a31ffcbc8fbd19eaeb48671a79a8ef16394672824510e"
},
"downloads": -1,
"filename": "case-converter-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "bf3c3631c3d1db44a46ee589a52ad2d7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8123,
"upload_time": "2022-04-16T18:13:44",
"upload_time_iso_8601": "2022-04-16T18:13:44.810227Z",
"url": "https://files.pythonhosted.org/packages/76/d9/48a4f2bb0dbea1086836a25b64ba77f5ab23652a12f45d9bbd2fe3f13d35/case-converter-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-04-16 18:13:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "chrisdoherty4",
"github_project": "python-case-converter",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "case-converter"
}