c++ - C++中的字符串到下/上

标签 c++ string unicode

人们发现在 C++ 中将字符串转换为小写/大写的最佳方法是什么?

由于 C++ 不是一种仅限英语的编程语言,因此问题变得更加复杂。有没有好的多语言方法?

最佳答案

#include <algorithm>
std::string data = "Abc";
std::transform(data.begin(), data.end(), data.begin(), ::toupper);

http://notfaq.wordpress.com/2007/08/04/cc-convert-string-to-upperlower-case/

另外,关于常见字符串方法的 CodeProject 文章:http://www.codeproject.com/KB/stl/STL_string_util.aspx

关于c++ - C++中的字符串到下/上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11491/

相关文章:

c++ - 将 const 放在函数声明之后是什么意思?

c++ - 连续信号句柄

string - 涉及随机访问字符串的重要算法?

svg - 在什么情况下,一种字体的每个 unicode 字符可以有多个字形,这是如何处理的?

java - 哪个系统组件负责在 Java 应用程序中绑定(bind) Unicode 连字?

c++ - 处理 boost 端点监听/运行错误

c++ - 在 Windows 上使用 native C++ 在具有多个网络适配器的机器上进行 UDP 广播

C: printf ("%s\n", str) 产生乱码?

string - 如何将 MATLAB 数组的所有元素合并为字符串?

c - 从命令行参数获取 unicode 符号