CamlCase conversion

/ Published in: Python
Save to your folder(s)

Turn a string LikeThis into like_this

Copy this code and paste it in your HTML
  1. def convert(name):
  2. s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
  3. return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.