strspn(返回字符串中第一个不在指定字符串中出现的字符下标)
头文件 #include<string.h>
函数定义size_t strspn( const char *s, const char * accept )
包含文件:string.h
函数名: strstr
函数原型:extern char *strstr(char *str1, char *str2);
功能:找出str2字符串在str1字符串中第一次出现的位置(不包括str2的串结束符)。
返回值:返回该位置的指针,如找不到,返回空指针。
#define _GNU_SOURCE
#include <string.h>
char *strcasestr(const char *haystack, const char *needle);
用于在c串haystack中查找c串needle,忽略大小写。如果找到则返回needle串在haystack串中第一次出现的位置的char指针.
在C语言中(string.h)定义了用于进行忽略大小写的字符串比较的函数strcasecmp及strncasecmp
strptime(),按照特定时间格式将字符串转换为时间类型。
#include <time.h> char *strptime(const char * buf ,const char * format , struct tm * tm ); 参数说明:buf | 时间字符串指针 |
format | 格式字符串指针 |
tm | 保存转换后结果的时间结构体指针 |
例子:
char fmt[] = "%Y-%m-%d-%H:%M:%S";
char buf[] = "2000-01-01-00:00:00"; struct tm tb; if (strptime(buf, fmt, &tb) != NULL) { fprintf(stdout "ok"); }