字符串处理

// 字符库处理函数
// 须有 #include <ctype.h>

// 字符串转化函数 stdlib.h中
//**************************************************************

double atof( char *nptr )             // 字符串转double
int atoi( const char *nptr )          //           int
long atol( const char *nptr )         //         long int
double strtod( const char *nptr, char **endptr)   //   转为double
long strtol                          //         long
unsigned long strtoul                        // unsigned long


char *strchr(const char *,int c )
//定位字符c首次出现在字符串s中的位置,如果找到c,返回一个指向s中字符c的指针,否则返回NULL
size_t strcspn( const char *s1, const char *s2 )
// 计算并返回字符串s1中不含字符串s2中字符的起始段的长度
size_t strspn( const char *s1, const char *s2 )
// 计算并返回字符串s1中只含字符串s2中字符的起始段的长度

char * strpbrk

char *strrchr
char *strstr

//**************************************************************

//        字符串处理库中的内在函数

void *memcpy( void *s1, const void *s2, size_t n)

void *memmove( void *s1, const void *s2, size_t n)
int  *memcmp( void *s1, const void *s2, size_t n)

void *memchr void *s1, int c, size_t n)
// 定位在s所指对象的前n个字符中首次出现字符c的位置

void *memset( void *s1, const void *s2, size_t n)

你可能感兴趣的:(字符串处理)