案例转换方法

to_upper()

#include <iostream>
#include <string>
#include <boost/algorithm/string.hpp>

using namespace std;

int main()
{

    // String to convert characters to uppercase

    string str = "ThIS iS SUpPoSEd tO Be UpPeR CAsE.";

    // Convert characters in str to upper case

    boost::to_upper(str);

    // Print str

    cout << str.c_str() << endl;

    // Waits for program to exit

    cin.get();

    return 0;
}

to_lower():

#include <iostream>
#include <string>
#include <boost/algorithm/string.hpp>

using namespace std;

int main()
{

    // String to convert characters to lowercase

    string str = "ThIS iS SUpPoSEd tO Be LoWer CAsE.";

    // Convert characters in str to lower case

    boost::to_lower(str);

    // Print str

    cout << str.c_str() << endl;

    // Waits for program to exit

    cin.get();

    return 0;
}