string字符串处理.doc.docVIP

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
string字符串处理.doc

C/C++头文件 #include assert.h    //设定插入点 #include ctype.h     //字符处理 #include errno.h     //定义错误码 #include float.h     //浮点数处理 #include fstream.h    //文件输入/输出 #include iomanip.h    //参数化输入/输出 #include iostream.h   //数据流输入/输出 #include limits.h    //定义各种数据类型最值常量 #include locale.h    //定义本地化函数 #include math.h     //定义数学函数 #include stdio.h     //定义输入/输出函数 #include stdlib.h    //定义杂项函数及内存分配函数 #include string.h    //字符串处理 #include strstrea.h   //基于数组的输入/输出 #include time.h     //定义关于时间的函数 #include wchar.h     //宽字符处理及输入/输出 #include wctype.h    //宽字符分类 string.h中的函数 @函数名称:???? strdup 函数原型:???? char *strdup(const char *s) 函数功能:???? 字符串拷贝,目的空间由该函数分配? 函数返回:???? 指向拷贝后的字符串指针 参数说明:???? src-待拷贝的源字符串 所属文件:???? string.h #include stdio.h #include string.h #include alloc.h int main() { ??? char *dup_str, *string=abcde; ??? dup_str=strdup(string); ??? printf(%s, dup_str); ??? free(dup_str); ??? return 0; } @函数名称:???? strcpy 函数原型:???? char* strcpy(char* str1,char* str2); 函数功能:???? 把str2指向的字符串拷贝到str1中去 函数返回:???? 返回str1,即指向str1的指针 参数说明: 所属文件:???? string.h #include stdio.h #include string.h int main() { ??? char string[10]; ??? char *str1=abcdefghi; ??? strcpy(string,str1); ??? printf(the string is:%s\n,string); ??? return 0; } @函数名称:???? strncpy 函数原型:???? char *strncpy(char *dest, const char *src,int count) 函数功能:???? 将字符串src中的count个字符拷贝到字符串dest中去 函数返回:???? 指向dest的指针 参数说明:???? dest-目的字符串,src-源字符串,count-拷贝的字符个数 所属文件:???? string.h #include stdio.h #include string.h int main() { ??? char string[10]; ??? char *str1=abcdefghi; ??? strncpy(string,str1,3); ??? string[3]=\0; ??? printf(%s,string); ??? return 0; } @函数名称:???? strcat 函数原型:???? char* strcat(char * str1,char * str2); 函数功能:???? 把字符串str2接到str1后面,str1最后的\0被取消 函数返回:???? str1 参数说明: 所属文件:???? string.h #include stdio.h #include string.h int main() { ??? char buffer[80]; ??? strcpy(buffer,Hello ); ??? strcat(buffer,world); ??? printf(%s\n,buffer); ??? return 0; } @函数名称:???? strncat 函数原型:???? char *strncat(char *dest, const char *src, size_t m

文档评论(0)

dreamzhangning + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档