文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>\<string.h\>字符串操作函数积累

\<string.h\>字符串操作函数积累

时间:2009-04-16  来源:hhtr001

这几天在处理文本,用到了一些string处理函数,有见过的,也有没见过的,统统记下来 ;-)
/*--------------------8<-------------------------
名称:
  strstr

参数:
  所要被匹配的大字符串
  子字符串

功能:
  子字符串匹配

返回:
  所匹配到的第一个子字符串的首地址

用法:
  #include <string.h>
  char * strstr(const char *haystack, const char *needle);

其他资料:
  man 3 strstr
-------------------8<--------------------------*/

/*--------------------8<-------------------------
名称:
  strlen

参数:
  所要被长度测量的字符串

功能:
  测量字符串长度

返回:
  返回该字符串的长度

用法:
  #include <string.h>
  size_t strlen(const char *s);

其他资料:
  man 3 strlen
-------------------8<--------------------------*/

/*--------------------8<-------------------------
名称:
  strdupa

参数:
  要操作的字符串

功能:
  创建该字符串的镜像,并紧跟着原字符串,在栈中扩展该字符串的所占空间,长度增加一倍.为gnu c扩展函数。

返回:
  返回新的字符串的首地址

用法:
  #define _GNU_SOURCE
  #include <string.h>
  size_t strlen(const char *s);

  编译时,要指定包含头文件路径
gcc -I/usr/include sample.c -o sample

其他资料:
  man 3 strlen
-------------------8<--------------------------*/

/*--------------------8<-------------------------
名称:
  strlen

参数:
  所要被长度测量的字符串

功能:
  测量字符串长度

返回:
  返回该字符串的长度

用法:
  #include <string.h>
  size_t strlen(const char *s);

其他资料:
  man 3 strlen
-------------------8<--------------------------*/

 
相关阅读 更多 +
排行榜 更多 +
平衡球球

平衡球球

休闲益智 下载
平衡球球游戏

平衡球球游戏

休闲益智 下载
土耳其方块消除游戏

土耳其方块消除游戏

休闲益智 下载