# string
## 字符串字面量
~~~
const char* a = "string a";
const char* b = u8"string b"; // UTF-8
const char16_t* c = u"string c"; // UTF-16
const char32_t* d = U"string d"; // UTF-32
const char* e = R"(string e1 "\\
stirng e2)"; // raw string
std::cout << a << std::endl;
std::cout << b << std::endl;
std::cout << c << std::endl;
std::cout << d << std::endl;
std::cout << e << std::endl;
R原始字符
auto xml = R"(<root>
<item value="1">
<item value="2">
</root>)";
~~~
## string常用方法
```
string str1 = "Hello World"
string str2 = "Hello World"s
string str2 = "hellow"sv string_veiw类型
```
```
```
## 高级数值转换
```
定义于头文件 <string>
std::string to_string( int value );
std::string to_string( long value );
std::string to_string( long long value );
std::string to_string( unsigned value );
std::string to_string( unsigned long value );
std::string to_string( unsigned long long value );
std::string to_string( float value );
std::string to_string( double value );
std::string to_string( long double value );
stoi
stol
stoll
转换字符串为有符号整数
(函数)
stoul
stoull
转换字符串为无符号整数
(函数)
stof
stod
stold
转换字符串为浮点值
```
- c++基础
- 官方在线文档
- auto typename decltype类型推导
- c++常用关键字
- 取消变量未使用警告
- 变量类型
- 字面量
- 指针和引用
- 统一初始化 结构化绑定
- foreach遍历
- using使用
- alignas alignof
- 模板
- 引用和完美转发
- 逗号表达式
- 异常 try catch
- string和string_view
- c++程序退出
- 函数参数类型和个数
- lambda
- 单例模式
- c++标准库
- 文档库
- cmath 算数库
- utilities
- array 数组
- vector 动态数组
- 变量类型推断function
- 正则表达式
- 随机数
- 多线程并发
- cout输出格式化
- 常用std函数
- hash定制
- c++使用第三方库实列
- google glog日志库
- gtest单元测试
- 线程池
- c++ rpc
- Mongoose网络协议
- cpp-httplib
- json ⚡ - JSON for Modern C++
- JeayeSON c++14
- ini文件解析库
- libuv uvw
- boost
- https://www.boost.org/doc/libs/1_79_0/
- ptree ini json xml
- dll
- lockfree
- socket
- cpp serial
- c++常用库列表
- c++常用调试技巧
- 死锁
- valgrind使用
- gdb
- core 生成
- c++编程总览