C++ strtolower()

1 개요[ | ]

C++ strtolower()
#include <iostream>
using namespace std;
string strtolower(string str) {
    for(auto &c: str) c = tolower(c);
    return str;
}
int main() {
    cout << strtolower("Hello World!") << endl; // hello world!
}
#include <iostream>
#include <algorithm> // transform
using namespace std;
string strtolower(const string str) {
    string ret = str;
    transform(ret.begin(), ret.end(),ret.begin(), ::tolower);
    return ret;
}
int main() {
    cout << strtolower("Hello World!") << endl; // hello world!
}

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}