How do I display the first letter as uppercase?

后端 未结 7 1457
孤城傲影
孤城傲影 2021-01-18 08:41

I have fname and lname in my database, and a name could be stored as JOHN DOE or john DOE or JoHN dOE, but ultimately I want to display it as John Doe

fname being Jo

7条回答
  •  遇见更好的自我
    2021-01-18 09:13

    I'm not sure where and how you want to display it, but if it's on a web-page you might try simply altering the display using CSS. Try adding:

    text-transform:capitalize;
    

    to the relevant rule, like this:

    .name { text-transform:capitalize;}
    

    if you put the name in a div or span with class="name". Of course, this will not in any way alter the database entry, but I wasn't clear which was preferable.

提交回复
热议问题