Convert between different types of cases (unicode supported)
Low maintenance activity. Last release 15 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity and recent releases.
Consider insteadcamel-converterPythie’s Index: 841.7M downloads/moCompare →
pip install case-conversion
Case Conversion
This is a port of the Sublime Text 3 plugin CaseConversion, by Davis Clark, to a regular python package. I couldn't find any other python packages on PyPI at the time (Feb 2016) that could seamlessly convert from any case to any other case without having to specify from what type of case I was converting. This plugin worked really well, so I separated the (non-sublime) python parts of the plugin into this useful python package. I also added Unicode support via python's unicodedata and extended the interface some.
Features
- Auto-detection of case (no need to specify explicitly which case you are converting from!)
- Acronym detection (no funky splitting on every capital letter of an all caps acronym like
HTTPError!) - Unicode supported (non-ASCII characters are first class citizens!)
- Dependency free!
- Supports Python 3.10+
- Every case conversion from/to you ever gonna need:
camel-> "camelCase"pascal/mixed-> "PascalCase" / "MixedCase"snake-> "snake_case"snake/kebab/spinal/slug-> "dash-case" / "kebab-case" / "spinal-case" / "slug-case"const/screaming_snake-> "CONST_CASE" / "SCREAMING_SNAKE_CASE"dot-> "dot.case"separate_words-> "separate words"slash-> "slash/case"backslash-> "backslash\case"ada-> "Ada_Case"http_header-> "Http-Header-Case"
Usage
Converter Class
Basic
>>> from case_conversion import Converter
>>> converter = Converter()
>>> converter.camel("FOO_BAR_STRING")
'fooBarString'