std::uppercase, std::nouppercase
來自 cppreference.com
定義於標頭檔案 <ios> |
||
std::ios_base& uppercase( std::ios_base& str ); |
(1) | |
std::ios_base& nouppercase( std::ios_base& str ); |
(2) | |
啟用浮點數和十六進位制整數輸出中使用大寫字元。對輸入沒有影響。
這是一個 I/O 操縱器,它可以透過 out << std::uppercase 這樣的表示式呼叫,對於任何型別為 std::basic_ostream 的 out
;或者透過 in >> std::uppercase 這樣的表示式呼叫,對於任何型別為 std::basic_istream 的 in
。
目錄 |
[編輯] 引數
str | - | I/O 流的引用 |
[編輯] 返回值
str(操作後的流的引用)。
[編輯] 示例
執行此程式碼
#include <iostream> int main() { std::cout << std::hex << std::showbase << "0x2a with uppercase: " << std::uppercase << 0x2a << '\n' << "0x2a with nouppercase: " << std::nouppercase << 0x2a << '\n' << "1e-10 with uppercase: " << std::uppercase << 1e-10 << '\n' << "1e-10 with nouppercase: " << std::nouppercase << 1e-10 << '\n'; }
輸出
0x2a with uppercase: 0X2A 0x2a with nouppercase: 0x2a 1e-10 with uppercase: 1E-10 1e-10 with nouppercase: 1e-10
[編輯] 參見
清除指定的 ios_base 標誌 (函式) | |
設定指定的 ios_base 標誌(函式) |