字符串函数
2022-07-02 09:25:46 百科资料
字符串函数(String processing function)也叫字符串处理函数,指的是编程语言中用来进行字符串处理的函数,如C,pascal,Visual以及LotusScript中进行字符串拷贝,计算长度,字符查找等的函数。
- 中文名称 字符串函数
- 外文名称 Stringprocessingfunction
c
strcpy
原型:extern char *strcpy(char *dest,char *src);
用法:#include <string.h>
功能:把src所指由NUL结束的字符串复制到dest所指的数组中。
返回指向dest结尾处字符(NUL)的指针。
举例:
// strcpy.c
#include <syslib.h>
#include <string.h>
main()
{
char *s="Golden Global View";
char d[20];
clrscr();
strcpy(d,s);
printf("%s",d);
getchar();
return 0;
}
strcat
原型:extern char *strcat(char *dest,char *src);
用法:#include <string.h>
功能:把src所指字符串添加到dest结尾处(覆盖dest结尾处的'