-
From: Martin Sebor
Sent: Wednesday, July 1, 2015 11:17 AM
To: p...@arbolone.ca ; Riot ; mingw-w64-public@lists.sourceforge.net
Cc: gcc-help Mailing List
Subject: Re: [Mingw-w64-public] toUpper()
On 07/01/2015 06:02 AM, p...@arbolone.ca wrote:
std::wstring source(LHello World);
std::wstring
On 30 June 2015 at 23:58, p...@arbolone.ca wrote:
I would like to write a function to capitalize letters, say...
std::wstring toUpper(const std::wstring wstr){
for ( auto it = wstr.begin(); it != wstr.end(); ++it){
global_wapstr.append(std::towupper(it));
}
}
This doesn’t work,
would be very much appreciated
-Original Message-
From: Martin Sebor
Sent: Tuesday, June 30, 2015 10:01 PM
To: Riot ; mingw-w64-public@lists.sourceforge.net
Cc: gcc-help Mailing List
Subject: Re: [Mingw-w64-public] toUpper()
On 06/30/2015 05:24 PM, Riot wrote:
#include algorithm
To: Riot ; mingw-w64-public@lists.sourceforge.net
Cc: gcc-help Mailing List
Subject: Re: [Mingw-w64-public] toUpper()
On 06/30/2015 05:24 PM, Riot wrote:
#include algorithm
#include string
std::string str = Hello World;
std::transform(str.begin(), str.end(), str.begin(), std
On 06/30/2015 05:24 PM, Riot wrote:
#include algorithm
#include string
std::string str = Hello World;
std::transform(str.begin(), str.end(), str.begin(), std::toupper);
Please note this code is subtly incorrect for two reasons.
There are two overloads of std::toupper:
1)
This one is way cooler
http://www.bing.com/search?q=touppersrc=IE-TopResultFORM=IETR02conversationid=
From: Alexandre Pereira Nunes
Sent: Tuesday, June 30, 2015 7:37 PM
To: mingw-w64-public@lists.sourceforge.net
Subject: Re: [Mingw-w64-public] toUpper()
[cut]
This may also help in future
I would like to write a function to capitalize letters, say...
std::wstring toUpper(const std::wstring wstr){
for ( auto it = wstr.begin(); it != wstr.end(); ++it){
global_wapstr.append(std::towupper(it));
}
}
This doesn’t work, but doesn’t the standard already have something like
#include algorithm
#include string
std::string str = Hello World;
std::transform(str.begin(), str.end(), str.begin(), std::toupper);
See also: http://www.cplusplus.com/reference/locale/toupper/
This may also help in future: http://lmgtfy.com/?q=c%2B%2B+toupper
-Riot
On 30
[cut]
This may also help in future: http://lmgtfy.com/?q=c%2B%2B+toupper
ROTFL! I didn't know that one.
As for std::toupper, IIRC there's an override which takes a locale
argument. But I'm not sure mingw-w64 support locales other than C in that
case. Last time I checked libstdc++ didn't