Gurus,
Is there a function in gcc which would convert a STRING (std::string) to upper case?
Thanks in Advance
Printable View
Gurus,
Is there a function in gcc which would convert a STRING (std::string) to upper case?
Thanks in Advance
std::transform() should work. I have two versions
of g++. On one it works, on another (older) it has
a compiler error.
Code:
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
string str = "Hello World";
transform(str.begin(),str.end(), str.begin() , toupper);
cout << str << endl;
return 0;
}
if you can use the windows.h header, use
Code:ToUpper(const char*);
thanks
oops, i made a mistake...
it's
Code:CharUpper(const char*);