字符串文字是用双引号(“”)括起来的一组字符。宽字符串文字始终以L为前缀。
字符串文字的类型-
| 序号 | 字符串文字和说明 | 
|---|---|
| 1 | ““无 前缀的字符串文字 | 
| 2 | L”“ 宽字符串文字 | 
| 3 | u8”“ UTF-8编码的字符串文字 | 
| 4 | u”“ UTF-16编码的字符串文字 | 
| 5 | U”“ UTF-32编码的字符串文字 | 
| 6 | R”“ 原始字符串文字 | 
这是C ++语言中的字符串文字的示例,
#include <cwchar>
#include <cwctype>
#include <iostream>
using namespace std;
int main() {
   wchar_t s[] = L"你好,世界!";
   wcout << L"The uppercase string : ”" << L"\"is ";
   for (int i = 0; i < wcslen(s); i++)
   putwchar(towupper(s[i]));
   return 0;
}输出结果
这是输出
The uppercase string : ""is 你好,世界!