Given a string like Marty Mcfly is there a regex or other one line solution to capitalize the ‘f’ so I get Marty McFly?
I can always count on the space between first and last and the first letter of the last name (i.e. the M) will always be caps.
I’m pretty open to just about any javascript, jquery, regex solution, I just need it to be short and sweet.
I’ve got a method that takes the string apart using indexOf and substring but I’m hoping theres a regex or something similar.
You can take advantage of the form of
String.replacewhich takes a function as its second argument: