1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- def to_camel_case(s):
- return s[0] + s.title().translate(None, "-_")[1:] if s else s
- def to_camel_case(text):
- removed = text.replace('-', ' ').replace('_', ' ').split()
- if len(removed) == 0:
- return ''
- return removed[0]+ ''.join([x.capitalize() for x in removed[1:]])
- def to_camel_case(text):
- return text[:1] + text.title()[1:].replace('_', '').replace('-', '')
- import re
- def to_camel_case(text):
- return re.sub('[_-](.)', lambda x: x.group(1).upper(), text)
- def to_camel_case(text):
- words = text.replace('_', '-').split('-')
- return words[0] + ''.join([x.title() for x in words[1:]])
- def to_camel_case(text):
- cap = False
- newText = ''
- for t in text:
- if t == '_' or t == '-':
- cap = True
- continue
- else:
- if cap == True:
- t = t.upper()
- newText = newText + t
- cap = False
- return newText
- def to_camel_case(text):
- return "".join([i if n==0 else i.capitalize() for n,i in enumerate(text.replace("-","_").split("_"))])
|