在C++中,可以使用std::wstring
来表示wchar_t
类型的字符串,然后使用+
运算符来进行字符串拼接。例如:
#include <iostream>
#include <string>
int main() {
std::wstring str1 = L"Hello, ";
std::wstring str2 = L"world!";
std::wstring result = str1 + str2;
std::wcout << result << std::endl;
return 0;
}
在上面的例子中,我们使用std::wstring
表示wchar_t
类型的字符串,然后使用+
运算符将两个字符串拼接在一起,最终输出结果为Hello, world!
。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:c++字符串拼接的方法是什么