名稱空間
變體
操作

std::uppercase, std::nouppercase

來自 cppreference.com
< cpp‎ | io‎ | manip
 
 
 
輸入/輸出操縱器
浮點格式化
整數格式化
布林格式化
欄位寬度和填充控制
其他格式化
uppercasenouppercase
空白字元處理
輸出重新整理
(C++20)  

狀態標誌操作
時間與金錢 I/O
(C++11)
(C++11)
(C++11)
(C++11)
帶引號的操縱器
(C++14)
 
定義於標頭檔案 <ios>
std::ios_base& uppercase( std::ios_base& str );
(1)
std::ios_base& nouppercase( std::ios_base& str );
(2)

啟用浮點數和十六進位制整數輸出中使用大寫字元。對輸入沒有影響。

1) 啟用流 str 中的 uppercase 標誌,如同呼叫了 str.setf(std::ios_base::uppercase)
2) 停用流 str 中的 uppercase 標誌,如同呼叫了 str.unsetf(std::ios_base::uppercase)

這是一個 I/O 操縱器,它可以透過 out << std::uppercase 這樣的表示式呼叫,對於任何型別為 std::basic_ostreamout;或者透過 in >> std::uppercase 這樣的表示式呼叫,對於任何型別為 std::basic_istreamin

目錄

[編輯] 引數

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 標誌
(函式) [編輯]