⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class.c

📁 HTML-XML-utils由一套小型C程序(过滤器)组成
💻 C
字号:
/* * Routines to check for the occurrence of a class. * * Author: Bert Bos <bert@w3.org> * Created: 20 Aug 2000 * Version: $Id: class.c,v 1.1 2000/08/20 16:31:52 bbos Exp $ * **/#include "config.h"#include <assert.h>#if STDC_HEADERS# include <string.h>#else# ifndef HAVE_STRCHR#  define strchr index#  define strrchr rindex# endif# ifndef HAVE_STRSTR#  include "strstr.e"# endif#endif#include <ctype.h>#include "export.h"#include "types.e"/* contains -- check if string contains a certain word, return pointer */EXPORT const string contains(const string s, const string word){  string t = s;  unsigned char c;  while ((t = strstr(t, word))) {    if ((c = *(t + strlen(word))) && !isspace(c)) t++; /* Not end of word */    else if (t != s && !isspace(*(t - 1))) t++;	/* Not beginning of word */    else return t;				/* Found it */  }  return NULL;					/* Not found */}/* has_class -- check for class=word in list of attributes */EXPORT Boolean has_class(pairlist attribs, const string word){  pairlist p;  for (p = attribs; p; p = p->next) {    if (strcasecmp(p->name, "class") == 0 && contains(p->value, word))      return True;  }  return False;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -