Skip to content

Instantly share code, notes, and snippets.

@Rigil-Kent
Created November 27, 2022 05:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rigil-Kent/e91b9afbd5ad6048aa7205bbda9af7ad to your computer and use it in GitHub Desktop.
Save Rigil-Kent/e91b9afbd5ad6048aa7205bbda9af7ad to your computer and use it in GitHub Desktop.
def camel_to_snake(data: str) -> str:
data = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', data)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', data).lower()
def snake_to_pascal(data: str) -> str:
return ''.join[word.title() for word in data.split('_')]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment