C++ c++;toupper-标准函数?
可能重复:C++ c++;toupper-标准函数?,c++,cross-platform,standard-library,c++-standard-library,C++,Cross Platform,Standard Library,C++ Standard Library,可能重复: 嗨, 我需要一个便携式函数来把C++中的字符串转换成大写字母。我现在正在使用toupper(char);作用它是标准函数吗?如果没有,跨平台的正确方法是什么?顺便问一下,有没有Web / wiki,我可以列出所有C++标准函数?谢谢。对于后一个问题,有。对于后一个问题,有。嗨,在我们的项目中,我们使用boost/algorithm/string to_upper function project For windows和linux嗨,在我们的项目中,我们使用boost/algori
嗨,
我需要一个便携式函数来把C++中的字符串转换成大写字母。我现在正在使用toupper(char);作用它是标准函数吗?如果没有,跨平台的正确方法是什么?顺便问一下,有没有Web / wiki,我可以列出所有C++标准函数?谢谢。对于后一个问题,有。对于后一个问题,有。嗨,在我们的项目中,我们使用boost/algorithm/string to_upper function project For windows和linux嗨,在我们的项目中,我们使用boost/algorithm/string to_upper function project For windows和linux是,
toupper
在cctype
标题中声明。可以使用以下算法转换字符串:
#include <algorithm>
#include <iostream>
#include <string>
#include <cctype>
int main()
{
std::string str("hello there");
std::cout << str << '\n';
std::transform(str.begin(), str.end(), str.begin(), std::toupper);
std::cout << str << '\n';
}
#包括
#包括
#包括
#包括
int main()
{
std::string str(“你好”);
std::coutYes,toupper
在cctype
头中声明。您可以使用算法转换字符串:
#include <algorithm>
#include <iostream>
#include <string>
#include <cctype>
int main()
{
std::string str("hello there");
std::cout << str << '\n';
std::transform(str.begin(), str.end(), str.begin(), std::toupper);
std::cout << str << '\n';
}
#包括
#包括
#包括
#包括
int main()
{
std::string str(“你好”);
std::您是否需要范围解析运算符?何时使用toupper(char)和何时使用toupper(char,locale)有何建议?您需要范围解析运算符何时使用toupper(char)和何时使用toupper(char,locale)有何建议?