Case Converter

1.2.0 · active · verified Wed Apr 15

A robust Python package (v1.2.0) for transforming string cases such as "Hello, world!" into "helloWorld" (camelCase). It offers various conversion types including camelCase, snake_case, kebab-case, macro_case, pascalCase, cobol-case, flatcase, and titlecase. The library is actively maintained with regular updates, and designed to be lightweight with no external dependencies.

Warnings

Install

Imports

Quickstart

Demonstrates basic string case conversion using various functions, including options for preserving punctuation and using custom delimiters.

import caseconverter as cc

text = "Hello, beautiful World!"

# Convert to camelCase
camel_text = cc.camelcase(text)
print(f"Original: '{text}' -> CamelCase: '{camel_text}'")

# Convert to snake_case
snake_text = cc.snakecase(text)
print(f"Original: '{text}' -> SnakeCase: '{snake_text}'")

# Convert to MACRO_CASE and keep punctuation
macro_text_with_punc = cc.macrocase("Hello, world! How are you?", strip_punctuation=False)
print(f"Original: 'Hello, world! How are you?' -> MacroCase (with punc): '{macro_text_with_punc}'")

# Convert to kebab-case using custom delimiters
kebab_custom_delims = cc.kebabcase("first_part-second part", delims=['_', ' '])
print(f"Original: 'first_part-second part' -> KebabCase (custom delims): '{kebab_custom_delims}'")

view raw JSON →