How do I display the first letter as uppercase?

后端 未结 7 1344
孤城傲影
孤城傲影 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:26

    seeing it is tagged PHP:
    either

    string ucfirst ( string $str );

    to uppercase first letter of the first word

    or

    string ucwords ( string $str );

    to uppercase the first letter of every word

    you might want to use those in combination with

    string strtolower ( string $str );

    to normalize all names to lower case first.

    0 讨论(0)
提交回复
热议问题