Capital Split

Published by bangyen in

Create a function which adds spaces before every capital in a word. Uncapitalize the whole string afterwards.

Examples

capSpace("helloWorld") ➞ "hello world"

capSpace("iLoveMyTeapot") ➞ "i love my teapot"

capSpace("stayIndoors") ➞ "stay indoors"

Notes

The first letter will stay uncapitalized.

Watch a quick demo on how Edabit works.