Casefy

1.1.0 · active · verified Fri Apr 10

Casefy is a lightweight Python package for converting the casing of strings. It supports various case styles like snake_case, camelCase, PascalCase, kebab-case, and more, including Unicode characters. The library has no third-party dependencies. It is currently at version 1.1.0 and receives updates as needed for bug fixes or new features.

Warnings

Install

Imports

Quickstart

Initialize the library by importing 'casefy', then use its various functions like `snakecase`, `camelcase`, or `pascalcase` to convert strings between different casing conventions.

import casefy

# Convert a string to snake_case
text = "HelloWorldExample123"
snake_cased_text = casefy.snakecase(text)
print(f"Original: {text}\nSnake Case: {snake_cased_text}")

# Convert to camelCase
camel_cased_text = casefy.camelcase("another-example_string")
print(f"Camel Case: {camel_cased_text}")

# Convert to PascalCase with specific grouping
pascal_cased_text = casefy.pascalcase("foo_bar_baz", keep_together=["BAR"])
print(f"Pascal Case: {pascal_cased_text}")

view raw JSON →