Codewars Challenge Day2: Break camelCase
Qroia FAK(C)E
Posted on July 13, 2022
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
💖 💪 🙅 🚩
Qroia FAK(C)E
Posted on July 13, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.