API Reference
Utilities for string case conversion.
- casefy.alphanumcase(string: str) str
Removes all non-alphanumeric symbols (including spaces).
For example:
"foo 123 _Bar!"
→"foo134Bar"
.- Parameters
string (
str
) – The string to convert.- Returns
The string containing only alphanumeric symbols.
- Return type
str
- casefy.camelcase(string: str) str
Convert a string into camelCase.
- Parameters
string (
str
) – The string to convert to camelCase.- Returns
The camelCased string.
- Return type
str
- casefy.capitalcase(string: str) str
Capitalize the first letter of a string.
The casing of all the other letters will remain unaltered, e.g.,
"fooBar"
→"FooBar"
.- Parameters
string (
str
) – The string to capitalize.- Returns
The capitalized string.
- Return type
str
- casefy.constcase(string: str) str
Convert a string into CONST_CASE.
- Parameters
string (
str
) – The string to convert.- Returns
The CONST_CASED string.
- Return type
str
- casefy.kebabcase(string: str) str
Convert a string into kebab-case.
- Parameters
string (
str
) – The string to convert to kebab-case.- Returns
The kebab-cased string.
- Return type
str
- casefy.lowercase(string: str) str
Lowercase a string.
- Parameters
string (
str
) – The string to convert.- Returns
The lowercased string.
- Return type
str
- casefy.pascalcase(string: str) str
Convert a string into PascalCase.
- Parameters
string (
str
) – The string to convert to CamelCase.- Returns
The CamelCased string.
- Return type
str
- casefy.sentencecase(string: str) str
Convert a string into Sentence case.
For example:
"fooBar"
→"Foo bar"
.- Parameters
string (
str
) – The string to convert to a sentence.- Returns
The converted string.
- Return type
str
- casefy.separatorcase(string: str, separator: str, keep_together: Optional[List[str]] = None) str
Convert a string into a case with an arbitrary separator.
- Parameters
string (
str
) – The string to convert.separator (
str
) – The separator to use.
- Returns
The separator cased string.
- Return type
str
- casefy.snakecase(string: str, keep_together: Optional[List[str]] = None) str
Convert a string into snake_case.
- Parameters
string (
str
) – The string to convert to snake_case.keep_together (
List[str]
, optional) – (Upper) characters to not split, e.g., “HTTP”.
- Returns
The snake_cased string.
- Return type
str
- casefy.titlecase(string: str) str
Convert a string into Title Sentence Case.
- Parameters
string (
str
) – The string to convert.- Returns
The Title Sentence Cased string.
- Return type
str
- casefy.uppercase(string: str) str
Convert string into UPPER CASE.
- Parameters
string (
str
) – The string to convert.- Returns
The UPPER CASED string.
- Return type
str
- casefy.upperkebabcase(string: str) str
Convert a string into UPPER-KEBAB-CASE.
- Parameters
string (
str
) – The string to convert.- Returns
The UPPER-KEBAB-CASED string.
- Return type
str