Before my program access the bellow code, the display is:
Country: CANAD¿
Number: 3872
After the code is this:
Country: CANADÁ
Number: 3,872
I need the letter Á to remain, but I also need the number to be displayed without a comma, what do I need to change in my code?
const std::wstring& ABC::strtools::toUpperCase( const std::wstring& _str )
throw(...) {
std::locale::global(std::locale(""));
std::wcout.imbue(std::locale());
auto& f = std::use_facet<std::ctype<wchar_t>>(std::locale());
this->setString(_str);
wapstr.clear();
wapstr.assign(this->getString());
f.toupper(&wapstr[0], &wapstr[0] + wapstr.size());
this->setString(wapstr);
return this->getString();
}
Your code fragment there is very disorganized. For example, you are doing a lot of setting and getting of the string property of your class -- you really shouldn't need to do anything but a single set, right?
In any case, the problem is that you are messing with std::wcout's locale. But you don't need to do that. (So don't.)