字符串处理函数
来源:互联网 发布:出售博客源码违法吗 编辑:程序博客网 时间:2024/06/10 13:20
#include <stdio.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
int main()
{
char p[] = "ABC";
char p1[] = "abc";
char s[] = "tom";
char s1[] = "";
printf("%s\n",strlwr(p));//转成小写
printf("%s\n",strupr(p1));
printf("%s\n",strcpy(s1,s));//s复制到s1
printf("%s\n",strncpy(s1,s,1));//1个字节
printf("%d\n",strcmp(s,s1));//判断大小
printf("%d\n",strncmp(s,s1,2));//取前2个字符串作为字串判断大小
printf("%d\n",stricmp(s,s1));//判断大小忽略大小写
printf("%d\n",strlen(s));//
printf("%s\n",strcat(s1,s));//把s添加到s1末尾
printf("%s\n",strncat(s1,s,2));//把s前n个添加到s1末尾
printf("%s\n",strrev(s));//颠倒
//printf("%s\n",memcpy(s,s1,2));//颠倒
return 0;
}
#include <math.h>
#include <ctype.h>
#include <string.h>
int main()
{
char p[] = "ABC";
char p1[] = "abc";
char s[] = "tom";
char s1[] = "";
printf("%s\n",strlwr(p));//转成小写
printf("%s\n",strupr(p1));
printf("%s\n",strcpy(s1,s));//s复制到s1
printf("%s\n",strncpy(s1,s,1));//1个字节
printf("%d\n",strcmp(s,s1));//判断大小
printf("%d\n",strncmp(s,s1,2));//取前2个字符串作为字串判断大小
printf("%d\n",stricmp(s,s1));//判断大小忽略大小写
printf("%d\n",strlen(s));//
printf("%s\n",strcat(s1,s));//把s添加到s1末尾
printf("%s\n",strncat(s1,s,2));//把s前n个添加到s1末尾
printf("%s\n",strrev(s));//颠倒
//printf("%s\n",memcpy(s,s1,2));//颠倒
return 0;
}
- PHP字符串处理函数
- 字符串处理函数
- javascript字符串处理函数
- 字符串处理函数
- c++(字符串处理函数)
- javascript字符串处理函数
- sql字符串处理函数
- JavaScript 处理字符串函数
- 两个字符串处理函数
- Javascript字符串处理函数
- JSTL字符串处理函数
- c++字符串处理函数
- [javascript]字符串处理函数
- javascript字符串处理函数
- C++字符串处理函数
- php字符串处理函数
- 字符串处理函数
- PHP字符串处理函数
- 类模板之队列
- 如何使用.NET调用新浪微博接口的实例
- 更改jboss默认使用的rmi端口,避免冲突
- java IO学习笔记
- 关于Object-C的NSAutoreleasePool的学习
- 字符串处理函数
- Silverlight 非模态的悬浮窗口
- 软件测试环境、平台和工具
- 探索 Pexpect
- 触摸,事件,UIGestureRecognizer
- DIV+CSS系列课程 (一) VS2008使用介绍
- MATLAB图像处理相关函数 非常有用
- 为已有的 WebForm 项目引入 Asp.Net MVC 框架
- 【MFC消息】无标题Dialog的拖动