C++ strtolower()

Jmnote (토론 | 기여)님의 2021년 4월 21일 (수) 19:19 판 (→‎개요)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

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 }}