codecamp

strtok

 原型:extern char *strtok(char *s, char *delim);
       
 用法:#include <string.h>
 
 功能:分解字符串为一组标记串。s为要分解的字符串,delim为分隔符字符串。
 
 说明:首次调用时,s必须指向要分解的字符串,随后调用要把s设成NULL。
       strtok在s中查找包含在delim中的字符并用NULL('\0')来替换,直到找遍整个字符串。
       返回指向下一个标记串。当没有标记串时则返回空字符NULL。
 
 举例:


     // strtok.c
     
     #include <syslib.h>
     #include <string.h>
     #include <stdio.h>
     main()
     {
       char *s="Golden Global View";
       char *d=" ";
       char *p;
       
       clrscr();
       
       p=strtok(s,d);
       while(p)
       {
         printf("%s\n",s);
         strtok(NULL,d);
       }
       getchar();
       return 0;
     }      


strstr
strnicmp,strncmpi
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

alloi动态内存

stdio输入输出函数

stdlib基础库函数

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }