#pragma once
#include<iostream>
#include<string>
#include"stringSpalicing.h"
using namespace std;
void test03() {
string str1 = "我";
str1 += "爱玩游戏!";
cout << "str1=" << str1 << endl;
str1 += ":";
cout << "str1=" << str1 << endl;
string str2 = "LOL DNF";
str1 += str2;
cout << "str1=" << str1 << endl;
string str3 = "I";
str3.append(" love ");
cout << "str3=" << str3 << endl;
str3.append("game abcd", 4);
cout << "str3=" << str3 << endl;
str3.append(str2);
cout << "str3=" << str3 << endl;
//参数2是从那个位置还是截,参数3是截取多少个字符
str3.append(str2, 4, 3);
cout << "str3=" << str3 << endl;
}
c++ strng 容器3
最新推荐文章于 2024-08-05 17:54:35 发布