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

📄 hhstring.h

📁 String Manipulation Routines
💻 H
📖 第 1 页 / 共 2 页
字号:
/*	H   H H	  H  SSS  TTTTT RRRR  IIIII N	N  GGG			*/
/*	H   H H	  H S	S   T	R   R	I   N	N G   G			*/
/*	H   H H	  H S	    T	R   R	I   NN	N G			*/
/*	HHHHH HHHHH  SSS    T	RRRR	I   N N N G  GG			*/
/*	H   H H	  H	S   T	R R	I   N  NN G   G			*/
/*	H   H H	  H S	S   T	R  R	I   N	N G   G			*/
/*	H   H H	  H  SSS    T	R   R IIIII N	N  GGG			*/
/*									*/
/************************************************************************/
/*									*/
/*	define function equates 					*/
/*									*/
#include <ctype.h>			/* for the "is..." macros	*/
#include <dos.h>			/* for DATE structure		*/
#include <string.h>			/* for ANSI string functions	*/

#define strequal(a, b)		!strcmp((a), (b))/* strequal = reverse	*/
						/*   of strcmp		*/
#define strnotequal(a, b)	strcmp((a), (b))/* strnotequal = strcmp */

#define streos(s) 	strset((s), '\0')/* streos = fill with EOSs	*/
#define strblank(s)	strset((s), ' ')/* strblank = fill with blanks	*/
#define strzero(s)	strset((s), '0')/* strzero = fill with ASCII 0s*/
#define strend(s)	((s) + strlen(s))/* strend = pointer to end of s*/
#define strdelwhite(s)	strchrdelgr((s), " \t\n\f\r\v")/* delete	*/
							/*   whitespace	*/
#define ptrfirstsub(a, b)	strstr((a), (b))
/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	define all ptrnext<...> functions as being the corresponding	*/
/*	ptrfirst<...> function, but with the pointer increased by one	*/
/*	(NOTE: ptrnextword and ptrnexttext  are exceptions to this)	*/
/*									*/
#define ptrnextblank(a)			ptrfirstblank(a+1)
#define ptrnextchr(a, b)		ptrfirstchr(a+1, b)
#define ptrnextchri(a, b)		ptrfirstchri(a+1, b)
#define ptrnextdig(a)			ptrfirstdig(a+1)
#define ptrnexthex(a)			ptrfirsthex(a+1)
#define ptrnextnotblank(a)		ptrfirstnotblank(a+1)
#define ptrnextnotchr(a, b)		ptrfirstnotchr(a+1, b)
#define ptrnextnotchri(a, b)		ptrfirstnotchri(a+1, b)
#define ptrnextnotdig(a)		ptrfirstnotdig(a+1)
#define ptrnextnothex(a)		ptrfirstnothex(a+1)
#define ptrnextnotrange(a, b, c)	ptrfirstnotrange(a+1, b, c)
#define ptrnextnotgr(a, b)		ptrfirstnotgr(a+1, b)
#define ptrnextnottextterm(a)		ptrfirstnottextterm(a+1)
#define ptrnextnotwhite(a)		ptrfirstnotwhite(a+1)
#define ptrnextnotwordterm(a)		ptrfirstnotwordterm(a)
#define ptrnextrange(a, b, c)		ptrfirstrange(a+1, b, c)
#define ptrnextgr(a, b)			ptrfirstgr(a+1, b)
#define ptrnextsub(a, b)		strstr(a+1, b)
#define ptrnextsubi(a, b)		ptrfirstsubi(a+1, b)
#define ptrnextwhite(a)			ptrfirstwhite(a+1)
#define ptrnextwordterm(a)		ptrfirstwordterm(a+1)
#define ptrnexttextterm(a)		ptrfirsttextterm(a+1)
/*	-	-	-	-	-	-	-	-	*/
/*                                                                      */
/*	define string constants						*/
/*									*/
#define	EOS		'\0'		/* C-language End-Of-String	*/
#define EOL		'\n'		/* C-language End-Of_Line	*/
/*	-	-	-	-	-	-	-	-	*/
/*									*/
/*	define macros							*/
/*									*/
#define ISBLANK(s)	(*(s) == ' ')
#define ISEOL(s)	(*(s) == '\n')
#define ISEOS(s)	(*(s) == '\0')
#define ISTAB(s)	(*(s) == '\t')
#define ISWHITE(s)	((*(s) == ' ') || (*(s) == '\t'))
#define ISWORDTERM(s)	(isspace(*(s)) || (*(s) == '\0'))
/*									*/
/* note that the following macro provides only PART of what is referred	*/
/* to in the documentation as a "text terminator" which consists of any	*/
/* of the characters in ISTEXTTERM but also includes any character in	*/
/* ISWORDTERM								*/
/*									*/
#define ISTEXTTERM(s)	((*(s) == '.') || (*(s) == '!') || (*(s) == '?') || (*(s) == ',') || (*(s) == ':') || (*(s) == ';'))
/*	-	-	-	-	-	-	-	-	*/
/*                                                                      */
/*	function prototypes for hhstring (alphabetical order)		*/
/*									*/
 unsigned int  atoh(char *hexstring);
 unsigned int  atoh2(int *nchars, char *hexstring);
unsigned long  atolh(char *hexstring);
unsigned long  atolh2(int *nchars, char *hexstring);
 unsigned int  atoo(char *octalstring);
 unsigned int  atoo2(int *nchars, char *octalstring);
	 char  btoc(int digit);
	  int  ctob(char c);
	  int  ctod(char c);
	  int  ctoh(char c);
	 char *date_without(char *date_string, char *separator);
	 char *date_withpad(char *date_string, char *separator, char padchar);
	 char  dtoc(int digit);
	 char *fnconv_1to2(char *fname);
	 char *fnconv_2to1(char *fname);
	 char  htoc(int digit);
	  int  isfilename(char *filename);
	 char *make_date_without(char *date_string, char *separator, struct dosdate_t *DATE);
	 char *make_date_withpad(char *date_string, char *separator, struct dosdate_t *DATE, char padchar);
	 char *ptrfirstblank(char *ptr);
	 char *ptrfirstchr(char *ptr, char find);
	 char *ptrfirstchri(char *ptr, char find);
	 char *ptrfirstdig(char *ptr);
	 char *ptrfirstgr(char *instring, char *chars);
	 char *ptrfirsthex(char *ptr);
	 char *ptrfirstnotblank(char *ptr);
	 char *ptrfirstnotchr(char *ptr, char find);
	 char *ptrfirstnotchri(char *ptr, char find);
	 char *ptrfirstnotdig(char *ptr);
	 char *ptrfirstnotgr(char *instring, char *chars);
	 char *ptrfirstnothex(char *ptr);
	 char *ptrfirstnotrange(char *instring, char c1, char c2);
	 char *ptrfirstnottextterm(char *ptr);
	 char *ptrfirstnotwhite(char *ptr);
	 char *ptrfirstnotwordterm(char *ptr);
	 char *ptrfirstrange(char *instring, char c1, char c2);
	 char *ptrfirstsubi(char *instring, char *substring);
	 char *ptrfirsttext(char *ptr);
	 char *ptrfirsttextterm(char *ptr);
	 char *ptrfirstwhite(char *ptr);
	 char *ptrfirstword(char *ptr);
	 char *ptrfirstwordterm(char *string);
	 char *ptrlastblank(char *string);
	 char *ptrlastchr(char *ptr, char findchar);
	 char *ptrlastchri(char *ptr, char findchar);
	 char *ptrlastdig(char *string);
	 char *ptrlastgr(char *string, char *chars);
	 char *ptrlasthex(char *string);
	 char *ptrlastnotblank(char *string);
	 char *ptrlastnotchr(char *string, char find);
	 char *ptrlastnotchri(char *string, char find);
	 char *ptrlastnotdig(char *string);
	 char *ptrlastnotgr(char *string, char *chars);
	 char *ptrlastnothex(char *string);
	 char *ptrlastnotrange(char *string, char c1, char c2);
	 char *ptrlastnottextterm(char *str);
	 char *ptrlastnotwhite(char *string);
	 char *ptrlastnotwordterm(char *string);
	 char *ptrlastrange(char *string, char c1, char c2);
	 char *ptrlastsub(char *string, char *substring);
	 char *ptrlastsubi(char *string, char *substring);
	 char *ptrlasttext(char *str);
	 char *ptrlasttextterm(char *str);
	 char *ptrlastwhite(char *string);
	 char *ptrlastword(char *string);
	 char *ptrlastwordterm(char *str);
	 char *ptrnexttext(char *ptr);
	 char *ptrnextword(char *ptr);
	 char *ptrprevblank(char *ptr);
	 char *ptrprevchr(char *ptr, char inchar);
	 char *ptrprevchri(char *ptr, char inchar);
	 char *ptrprevdig(char *string);
	 char *ptrprevgr(char *ptr, char *chars);
	 char *ptrprevhex(char *string);
	 char *ptrprevnotblank(char *ptr);
	 char *ptrprevnotchr(char *ptr, char find);
	 char *ptrprevnotchri(char *ptr, char find);
	 char *ptrprevnotdig(char *ptr);
	 char *ptrprevnotgr(char *ptr, char *chars);
	 char *ptrprevnotrange(char *ptr, char c1, char c2);
	 char *ptrprevnottextterm(char *ptr);
	 char *ptrprevnotwhite(char *ptr);

⌨️ 快捷键说明

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