3C科技 娛樂遊戲 美食旅遊 時尚美妝 親子育兒 生活休閒 金融理財 健康運動 寰宇綜合

Zi 字媒體

2017-07-25T20:27:27+00:00
加入好友
Linux C function() 參考手冊:strncasecmp(忽略大小寫比較(比對)字串)   資料來源:http://people.cs.nctu.edu.tw/~yslin/library/linuxc/main.htm線上執行:http://www.tutorialspoint.com/compile_c_online.phpcode2html:http://tohtml.com/   相關函數bcmp,memcmp,strcmp,strcoll,strncmp表頭文件#include定義函數int strncasecmp(const char *s1,const char *s2,size_t n);函數說明strncasecmp()用來比較參數s1和s2字符串前n個字符,比較時會自動忽略大小寫的差異。返回值若參數s1和s2 字符串相同則返回0。s1 若大於s2則返回大於0的值,s1若小於s2則返回小於0 的值。   範例   #include <string.h> #include <stdio.h> int main() { char *a="aBcDeF"; char *b="AbCdEf"; if(!strncasecmp(a,b,6)) { printf("%s =%s\n",a,b); } return 0; }    

本文由jashliaoeuwordpress提供 原文連結

寫了 5860316篇文章,獲得 23313次喜歡
精彩推薦