strings.snake_case_to_camel_pascal_case

Functions

snake_to_camel_case(→ str)

Transforms a snake_case given string to camelCase (or PascalCase if indicated)

Module Contents

strings.snake_case_to_camel_pascal_case.snake_to_camel_case(input_str: str, use_pascal: bool = False) str

Transforms a snake_case given string to camelCase (or PascalCase if indicated) (defaults to not use Pascal)

>>> snake_to_camel_case("some_random_string")
'someRandomString'
>>> snake_to_camel_case("some_random_string", use_pascal=True)
'SomeRandomString'
>>> snake_to_camel_case("some_random_string_with_numbers_123")
'someRandomStringWithNumbers123'
>>> snake_to_camel_case("some_random_string_with_numbers_123", use_pascal=True)
'SomeRandomStringWithNumbers123'
>>> snake_to_camel_case(123)
Traceback (most recent call last):
    ...
ValueError: Expected string as input, found <class 'int'>
>>> snake_to_camel_case("some_string", use_pascal="True")
Traceback (most recent call last):
    ...
ValueError: Expected boolean as use_pascal parameter, found <class 'str'>