Name Kata: Break camelCase / 6kuy
Details
Complete the solution so that the function will break up camel casing, using a space between words.
Example
'camelCase' -> 'camel Case'
My Solutions
JavaScript
const solution = (str) => {
return str.split(/\s+|\_+|(?=[A-Z])/gm).join(' ')
}
Python
def solution(string: str) -> str:
res = ''
for symbol in string:
if symbol.upper() == symbol:
res = res + ' ' + symbol
else:
res = res + symbol
return res
© 版权声明
THE END
暂无评论内容