C++11 からの複数行の文字列 - multi-line string ― 2020年07月26日 12時54分05秒
char str[] = "one\n"
"two\n"
"three\n";
また、バックスラッシュ、円記号による複数行も使うことも出来る。
char str[] = "one\
two\
three\n";
C++11 から複数行にわたる文字列を定義するリテラルが導入された。
また、文字列中に閉じ括弧が含まれている時のために、終端文字を指定することも出来る。
std::string str = R"(one
two
three)"
std::string str = R"EOB(one
two
three)EOB"
最近のコメント