名前空間
変種
操作

std::uppercase, std::nouppercase

提供: cppreference.com
< cpp‎ | io‎ | manip
 
 
入出力ライブラリ
入出力マニピュレータ
Cスタイルの入出力
バッファ
(C++98で非推奨)
ストリーム
抽象
ファイル入出力
文字列入出力
配列入出力
(C++98で非推奨)
(C++98で非推奨)
(C++98で非推奨)
同期化出力
エラーカテゴリインタフェース
(C++11)
 
入出力マニピュレータ
浮動小数点フォーマット
整数フォーマット
ブーリアンフォーマット
フィールド幅とフィル制御
その他のフォーマット
uppercasenouppercase
ホワイトスペース処理
出力のフラッシュ
ステータスフラグ操作
時間と通貨の入出力
(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)

浮動小数点および16進整数の出力における大文字の使用を有効化します。 入力には効果がありません。

1) str.setf(std::ios_base::uppercase) を呼ぶことによって、ストリーム struppercase フラグを有効化します。

2) str.unsetf(std::ios_base::uppercase) を呼ぶことによって、ストリーム struppercase フラグを無効化します。

これは入出力マニピュレータであり、 std::basic_ostream 型の任意の out に対する out << std::uppercase のような式や std::basic_istream 型の任意の in に対する in >> std::uppercase のような式で呼ぶことができます。

目次

[編集] 引数

str - 入出力ストリームへの参照

[編集] 戻り値

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 のフラグをクリアします
(関数) [edit]
指定された ios_base のフラグを設定します
(関数) [edit]