Hi all
I have been looking at options to capitalize the first letter of both names for users who have two first names saved in our database. For example: 'tony peter' becomes 'Tony Peter'.
I can make it work with a for loop but the docs suggest 'map' and 'join' should work which would considerably reduce the liquid.
Here is what I have that just won't play ball and I can't seem to find where it is failing:
{% assign fullName = "tony peter" %}
{% assign names = fullName | split: ' ' %}
{% assign capitalizedNames = names | map: 'capitalize' %}
{{ capitalizedNames | join: ' ' }}
I'm looking to split the first names at the space into an array so they can be worked on one at a time. The liquid then maps over the array, capitalizing each first letter. Once complete, rejoining into a complete string with a space in the middle.
Any advice would be great.