In an app there is a form where user enter their lastname. These lastnames are later used and I want them to all be written the same. first letter(s) in uppercase, the rest in lowercase.
It looks simple enought but here come the lastnames with multiple parts, sometimes separated by a space, sometimes separated by a dash.
I thought I’ve found the solution with Laravel helper Str::title
Str::title("Cholley"); returns Cholley
Str::title("van basten");returns Van Basten
Str::title("gut-behrami"); returns Gut-Behrami
It was perfect until McDonald and M’Bolhi came along…
Str::title("mcdonald"); returns Macdonald (obviously)
Str::title("m'bolhi"); returns M'bolhi (for this one I have to say my hopes were high)
I’ve tried to manualy insert in the database a ‍ or a ‌ between the ‘C’ and the ‘D’ but it doesn’t work.
Did someone already have and solve this issue ? Do you have any ideas ? someone from Irland maybe…
Any help would be greatly appreciated