strings.camel_case_to_snake_case

Functions

camel_to_snake_case(→ str)

Transforms a camelCase (or PascalCase) string to snake_case

Module Contents

strings.camel_case_to_snake_case.camel_to_snake_case(input_str: str) str

Transforms a camelCase (or PascalCase) string to snake_case

>>> camel_to_snake_case("someRandomString")
'some_random_string'
>>> camel_to_snake_case("SomeRandomStr#ng")
'some_random_str_ng'
>>> camel_to_snake_case("123someRandom123String123")
'123_some_random_123_string_123'
>>> camel_to_snake_case("123SomeRandom123String123")
'123_some_random_123_string_123'
>>> camel_to_snake_case(123)
Traceback (most recent call last):
    ...
ValueError: Expected string as input, found <class 'int'>