1. 字符串基础
// 字符串声明和初始化
string str1 = "hello";
string str2("world");
string str3(5, 'a'); // "aaaaa"
// 常用操作
str1.length(); // 或 str1.size()
str1.empty(); // 判断是否为空
str1 += str2; // 字符串拼接
str1.append("text"); // 追加
str1.substr(0, 3); // 子串提取
str1.find("pattern"); // 查找
1/7/2025About 2 min
