Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to convert character to lowercase c++

#include <iostream>
#include <string>
#include <boost/algorithm/string.hpp>
#include <iostream>
#include <bits/stdc++.h> 

using namespace std; 

int main() { 
    // way 1
    string s1 = "HeNrY DeUtScH";
    boost::to_lower(s1);
    cout << s1 << endl;

    // way 2
    string s2 = "HeNrY DeUtScH";
    transform(s2.begin(), s2.end(), s2.begin(), ::tolower); //lowercase
    cout << s2 << endl; 

    // way 3
    string s3 = "HeNrY DeUtScH";
    for (int i = 0; i < s3.size(); i++) cout << (char) tolower(s3[i]);
    cout << endl;

    return 0;
}
 
PREVIOUS NEXT
Tagged: #convert #character #lowercase
ADD COMMENT
Topic
Name
5+7 =