Convert first letter in string to uppercase

后端 未结 5 1109
隐瞒了意图╮
隐瞒了意图╮ 2020-12-02 23:27

I have a string: \"apple\". How can I convert only the first character to uppercase and get a new string in the form of \"Apple\"?

I can al

5条回答
  •  爱一瞬间的悲伤
    2020-12-03 00:00

    Like what Carneigie said,

    string str = "something";
    str[0] = toupper(str[0]);
    

    but also remember to:

    #include 
    #include 
    

    all the way up

提交回复
热议问题