Recent searches
No recent searches
Capitalise names with apostrophes
Answered
Posted Aug 16, 2022
How can we use liquid JS to change
bob o’dwyer to Bob O’Dwyer
Note first letter plus after apostrophe is capital
0
1
Recent searches
No recent searches
Posted Aug 16, 2022
0
1 comment
Jason Littrell
Hey Sal. Here's one way to can accomplish that (whitespace added for clarity):
Here it is without spaces:
That last `unless` block has a placeholder with a single space text string because a regular space kept getting collapsed when I applied the code with a macro. If you use the code in a dynamic content placeholder, a regular space should work fine and you could even use the first code block by adding a dash inside the opening or closing tags where you want whitespace to be removed (see here for more info).
You'll probably need to test for edge cases, and the code doesn't account for user names formatted as "<last_name>, <first_name>", but hopefully it's enough to get you started.
0