设为首页 加入收藏

TOP

VC字符串拼接插入处理函数功能详解
2014-11-23 21:34:52 】 浏览:561
Tags:字符串 拼接 插入 处理 函数 功能 详解

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”

本文来自: 雪域博客

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇VC++ strrev 字符串倒转函数功能.. 下一篇VC++字符串转换为LPCWSTR UNICODE..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目