Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def to_camel_case(text):
- if len(text) >= 1:
- i=0
- while i < len(text):
- if '_' in text:
- if text[i] == '_':
- text = text[:i:] + text[i + 1::]
- if '-' in text:
- if text[i] == '-':
- text = text[:i:] + text[i + 1].upper() + text[i + 2::]
- i+=1
- print(text)
- return text
- else:
- return ''
- def main():
- text='the-stealth-warrior'
- text.swapcase()
- to_camel_case(text)
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement