直播平台搭建源码,LintCode 大小写转换

直播平台搭建源码,LintCode 大小写转换

一、直接利用C++中的tolower(大写转小写)函数。

 


class Solution {
public:
    /**
     * @param str: the input string
     * @return: The lower case string
     */
    string toLowerCase(string &str) {
        // Write your code here
        for( int i=0; i<str.length(); i++ ){
            str[i] = tolower(str[i]);
        }
        return str;
    }
};

 

 


class Solution {
public:
    /**
     * @param str: the input string
     * @return: The lower case string
     */
    string toLowerCase(string &str) {
        // Write your code here
        for(int i=0;i<str.size();i++)
        {
            if(str[i]>='A'&&str[i]<='Z')
            {
                str[i]+=32;
            }
        }
        return str;
    }
};

 

 以上就是直播平台搭建源码,LintCode 大小写转换, 更多内容欢迎关注之后的文章

 

posted @ 2023-06-09 14:08  云豹科技-苏凌霄  阅读(13)  评论(0编辑  收藏  举报