You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
8 lines
328 B
Python
8 lines
328 B
Python
import re
|
|
|
|
|
|
def convert_camel_case_into_kebab_case(string):
|
|
# Inspired from https://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-snake-case # noqa: E501
|
|
first_pass = re.sub('(.)([A-Z][a-z]+)', r'\1-\2', string)
|
|
return re.sub('([a-z0-9])([A-Z])', r'\1-\2', first_pass).lower()
|