- cctype[meta header]
- std[meta namespace]
- function[meta id-type]
namespace std {
int toupper(int ch);
}ch を大文字に変換する(変換はロケールの影響を受ける)。
ch に大文字があれば、大文字化した ch。大文字がなければ ch。
#include <cctype>
#include <iostream>
int main() {
std::cout << "toupper('A') = " << static_cast<char>(std::toupper('A')) << std::endl
<< "toupper('a') = " << static_cast<char>(std::toupper('a')) << std::endl
<< "toupper('1') = " << static_cast<char>(std::toupper('1')) << std::endl
<< "toupper('.') = " << static_cast<char>(std::toupper('.')) << std::endl
<< "toupper('$') = " << static_cast<char>(std::toupper('$')) << std::endl;
}- std::toupper[color ff0000]
toupper('A') = A
toupper('a') = A
toupper('1') = 1
toupper('.') = .
toupper('$') = $
int toupper(int ch) {
if (islower(ch)) {
ch ^= 32;
}
return ch;
}