C++ std::toupper 与 tolower 对称。
原型
int toupper(int ch);参数
ch:按 unsigned char。
返回值
转换后的字符编码。
示例
#include <cctype>
#include <iostream>
int main() {
char c = static_cast<char>(std::toupper('b'));
std::cout << c << "\n";
return 0;
}输出:
B
注意事项
非字母字符保持不变。