串和字符串函数

来源:互联网 发布:淘宝上怎么没有卖刀的 编辑:程序博客网 时间:2024/05/17 07:56

 <!--@page { margin: 2cm }P { margin-bottom: 0.21cm }-->

串和字符串

1.isalnum

#include<ctype.h>

intisalnum(int ch);

函数是判断字符是否是字母或数字。若是,返回非0值。否则返回0;


2。isalpha

#include<ctype.h>

intisalpha(int ch);

函数是判断字符是否是字母。若是,则返回非0;否则返回0;


3。isblank

#include<ctype.h>

intisblack(int ch)


4.isdigit

#include<ctype.h>

intisdigit(int ch);

ch为数字时(0--9),函数返回非0值


5.islower

#include<ctype.h>

intislower(int ch);

如果ch为小写字母,函数返回非0值。



6.ispunct

#include<ctype.h>

intispunct(int ch)

如果ch是标点符号,函数返回非0值。


7.isspace

#include<ctype.h>

intisspace(int ch);

ch为空白字符,包括空格/水平制表符/垂直制表符/换页/回车/新行符时,函数返回于非0。


8.isupper

#include<ctype.h>

intisupper(int ch);

如果ch是大写字母,函数返回非0值


9.memchr

#include<string.h>

void*memchr(const void *buf,int ch,size_t count);

buf前count返回首次出现ch的地址;若未找到,返回空指针。



10.memcpy

#include<string.h>

intmemcmp(const void *buf1,const void *buf2,size_t count);

函数比较buf1和buf2指向的数组的前count个字节。结果为buf1-buf2


11memcpy

#include<string.h>

void*memcpy(void *to ,const void *from,size_t count);

函数将从from指向的数组向to指向的数组复制count个字符。


12.memmove

#include<string.h>

void*memmove(void *to,const void *from,size_t count);

功能和memcpy。只是当to和from同地址时仍执行。


13.memset

#include<string.h>

void*memset(void *buf,int ch,size_t count);


14.strcat

追加


15.strchr

#include<string.h>

char*strchr(const char *str,int ch);

返回str中第一次出现ch的地址。若没有,返回空指针


16.strcmp

#include<string.h>

intstrcmp(const char *str1,const char str2);

函数返回str1-str2


17.strcpy

#include<string.h>

char*(char *str1,const char *str2);


18.strlen

#include<string.h>

size_tstrlen(const char *str);


19.strncat

#include<string.h>

char*strncat(char *str1,const char *str2,size_t count);

str2前count字节追加到str1



20.strncmp

#include<string.h>

intstrncmp(const char *str1,const char *str2,size_t count)

比较前count字节。str1-str2


21.strncpy

#include<string.h>

char*strncpy(char *str1,const char *str2,size_t count);

复制前count字节


22.tolower

#include,ctype.h>

inttolower(int ch);

返回小写。Ch值不变


23.toupper

#include<ctype.h>

inttoupper(int ch);

返回大写。