DEV Community

loading...

Discussion on: Daily Challenge #34 - WeIrD StRiNg CaSe

Collapse
shaber profile image
ShaBer • Edited

A JS single line solution that works with multi-line texts:

toWeirdCase=s=>s.replace(/[A-z][^]?/g,m=>m[0].toUpperCase()+(m[1]||'').toLowerCase());
Enter fullscreen mode Exit fullscreen mode