函式名: stpcpy
功能: 拷貝乙個字串到另乙個
用法: char *stpcpy(char *destin, char *source);
程式例:
#include
#include
int main(void)
函式名: strcat
功能: 字串拼接函式
用法: char *strcat(char *destin, char *source);
程式例:
#include
#include
int main(void)
函式名: strchr
功能: 在乙個串中查詢給定字元的第乙個匹配之處\
用法: char *strchr(char *str, char c);
程式例:
#include
#include
int main(void)
函式名: strcmp
功能: 串比較
用法: int strcmp(char *str1, char *str2);
看asic碼,str1>str2,返回值 > 0;兩串相等,返回0
程式例:
#include
#include
int main(void)
函式名: strncmpi
功能: 將乙個串中的一部分與另乙個串比較, 不管大小寫
用法: int strncmpi(char *str1, char *str2, unsigned maxlen);
程式例:
#include
#include
int main(void)
函式名: strcpy
功能: 串拷貝
用法: char *strcpy(char *str1, char *str2);
程式例:
#include
#include
int main(void)
函式名: strcspn
功能: 在串中查詢第乙個給定字符集內容的段
用法: int strcspn(char *str1, char *str2);
程式例:
#include
#include
#include
int main(void)
函式名: strdup
功能: 將串拷貝到新建的位置處
用法: char *strdup(char *str);
程式例:
#include
#include
#include
int main(void)
函式名: stricmp
功能: 以大小寫不敏感方式比較兩個串
用法: int stricmp(char *str1, char *str2);
程式例:
#include
#include
int main(void)
函式名: strerror
功能: 返回指向錯誤資訊字串的指標
用法: char *strerror(int errnum);
程式例:
#include
#include
int main(void)
函式名: strcmpi
功能: 將乙個串與另乙個比較, 不管大小寫
用法: int strcmpi(char *str1, char *str2);
程式例:
#include
#include
int main(void)
{ char *buf1 = "bbb", *buf2 = "bbb";
int ptr;
ptr = strcmpi(buf2, buf1);
if (ptr > 0)
printf("buffer 2 is greater than buffer 1\n");
if (ptr < 0)
printf("buffer 2 is less than buffer 1\n");
C字串函式大全
字串1 字串的長度用length表示,string s hello!int l 越界時會出現indexoutofrang 2 複製字串 string string1 how do you do string string2 string1 copy 函式。string string2 copyto ...
C語言 字串函式大全和詳解
atof 將字串轉換成浮點型數 atoi 將字串轉換成整型數 atol 將字串轉換成長整型數 strtod 將字串轉換成浮點數 strtol 將字串轉換成長整型數 strtoul 將字串轉換成無符號長整型數 toascii 將整型數轉換成合法的ascii 碼字元 toupper 將小寫字母轉換成大寫...
C語言 字串函式大全和詳解
void memset void dest,int c,size t count 將dest前面count個字元置為字元c.返回dest的值.void memmove void dest,const void src,size t count 從src複製count位元組的字元到dest.如果src...