【VC++】VC 字符串拼接插入处理函数功能详解

admin 2021年4月3日19:01:49评论72 views字数 2171阅读7分14秒阅读模式

    VC++ 字符串拼接插入处理函数功能详解,VC++ 字符串拼接插入处理函数功能,VC++ 字符串拼接插入处理函数详解,VC++ 字符串拼接插入处理功能详解,VC++ 字符串拼接插入处理函数,VC++ 字符串拼接插入处理功能,VC++ 字符串拼接插入处理详解,VC++ 字符串拼接处理函数,VC++ 字符串拼接处理功能,VC++ 字符串拼接处理详解,VC++ 字符串插入处理函数,VC++ 字符串插入处理功能,VC++ 字符串插入处理详解,VC++ 字符串拼接函数,VC++ 字符串拼接功能,VC++ 字符串拼接详解,VC++ 字符串拼接,VC++ 拼接字符串,VC++ 字符串,VC++ 拼接,#include //加一个头文件,/*......*/,char *str1,*str2,*str3,*str4;,strcpy (str1,"exp"); //复制"exp"到str1,strcpy (str2,"plorer");,strcpy (str3,"exe");,strcat (str1,str2); //将str2连接到str1后,strcat (str2,str3);,strcpy (str4,str3); //str4值为"explorer.exe",#include //加一个头文件,using namespace std; //声明名空间,string *str1,*str2,*str3;,str1.assign ("explo"); //复制"explo"到str1,str2.assign ("rer.exe");,str1.append (str2); //将str2连接到str1后,str3.assign (str1); //str3值为"explorer.exe",#include //加一个头文件,using namespace std; //声明名空间,string *s1="abcexplorer.exekgh";,s1.substr(3,12); //3为从第三个字节开始读取,12为读取12个字符,#include //加一个头文件,using namespace std; //声明名空间,string *s1="ex.exe";,string *s2="plorer";,s1.insert(2,s2); //在第2个字节后插入s2的值,#include //加一个头文件,using namespace std; //声明名空间,string *s1="explorer.exe";,string *s2="ip.tet",s1.swap (s2); //交换s1与s2的值,s2值为"explorer.exe"。

VC++ 字符串拼接插入处理函数功能详解:

下面是修改的详细方法(我用"explorer.exe"作为例子修改)
1、  
#include    //加一个头文件
/*......*/
char *str1,*str2,*str3,*str4;
strcpy (str1,"exp"); //复制"exp"到str1
strcpy (str2,"plorer");
strcpy (str3,"exe");
strcat (str1,str2);    //将str2连接到str1后
strcat (str2,str3);
strcpy (str4,str3);   //str4值为"explorer.exe"

2、
#include    //加一个头文件
using namespace std;   //声明名空间
/*......*/
string *str1,*str2,*str3;
str1.assign ("explo");   //复制"explo"到str1
str2.assign ("rer.exe");
str1.append (str2);   //将str2连接到str1后
str3.assign (str1);    //str3值为"explorer.exe"

3、
#include    //加一个头文件
using namespace std;   //声明名空间
/*......*/
string *s1="abcexplorer.exekgh";
s1.substr(3,12);   //3为从第三个字节开始读取,12为读取12个字符

4、
#include    //加一个头文件
using namespace std;   //声明名空间
/*......*/
string *s1="ex.exe";
string *s2="plorer";
s1.insert(2,s2);   //在第2个字节后插入s2的值

5、
#include    //加一个头文件
using namespace std;   //声明名空间
/*......*/
string *s1="explorer.exe";
string *s2="ip.tet"
s1.swap (s2);   //交换s1与s2的值,s2值为"explorer.exe"

文章来源于lcx.cc:【VC++】VC 字符串拼接插入处理函数功能详解

相关推荐: 刚在一网站看见的律师案例介绍 - 陈灏简介

    以下内容,只可意会,不可言传……,不敢有敏感词汇,万一收到法院传票那就不好了……,记住:只可意会,不可言传!     声明:以下内容转载于网络,网址为:http://www.029148148.com/lslm.asp?id=35,以下内容产生的一切后…

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年4月3日19:01:49
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   【VC++】VC 字符串拼接插入处理函数功能详解http://cn-sec.com/archives/319659.html

发表评论

匿名网友 填写信息