this is my first question so if I make mistakes I'm really sorry
I have a variable called foo and it contains the string "helloWorld" is there any way to make it to "hello world" like how unity does with the variables in the script
Im using typescript btw
and Thanks
CodePudding user response:
A simple regex replace should do the trick for you:
"fooBarBaz".replace(/[A-Z]/g, (m) => " " m.toLowerCase());
// "foo bar baz"