Annotation of libwww/Library/src/HTString.html, revision 2.25
2.11 frystyk 1: <HTML>
2: <HEAD>
2.25 ! frystyk 3: <TITLE>Generic String Handling</TITLE>
! 4: <!-- Changed by: Henrik Frystyk Nielsen, 13-Nov-1995 -->
2.11 frystyk 5: </HEAD>
2.6 timbl 6: <BODY>
2.9 frystyk 7:
2.25 ! frystyk 8: <H1>Generic String Management</H1>
2.11 frystyk 9:
10: <PRE>
11: /*
2.15 frystyk 12: ** (c) COPYRIGHT MIT 1995.
2.11 frystyk 13: ** Please first read the full copyright statement in the file COPYRIGH.
14: */
15: </PRE>
2.9 frystyk 16:
17: These functions provide functionality for case-independent string
18: comparison and allocations with copies etc. <P>
19:
20: This module is implemented by <A HREF="HTString.c">HTString.c</A>, and
21: it is a part of the <A NAME="z10"
2.21 frystyk 22: HREF="http://www.w3.org/pub/WWW/Library/">
2.18 frystyk 23: W3C Reference Library</A>. <P>
2.9 frystyk 24:
2.8 frystyk 25: <PRE>
26: #ifndef HTSTRING_H
2.1 timbl 27: #define HTSTRING_H
2.9 frystyk 28: </PRE>
29:
2.17 frystyk 30: <H2><A NAME="dyn">Dynamic String Manipulation</A></H2>
2.9 frystyk 31:
32: These two functions are dynamic versions of <CODE>strcpy</CODE> and
33: <CODE>strcat</CODE>. They use <CODE>malloc</CODE> for allocating space
34: for the string. If <CODE>StrAllocCopy</CODE> is called with a non-NULL
35: dest, then this is freed before the new value is assigned so that only
36: the <EM>last</EM> string created has to be freed by the user. If
37: <CODE>StrAllocCat</CODE> is called with a NULL pointer as destination
38: then it is equivalent to <CODE>StrAllocCopy</CODE>.
2.1 timbl 39:
2.9 frystyk 40: <PRE>
41: #define StrAllocCopy(dest, src) HTSACopy (&(dest), src)
42: #define StrAllocCat(dest, src) HTSACat (&(dest), src)
2.24 frystyk 43:
44: extern char * HTSACopy (char **dest, CONST char *src);
45: extern char * HTSACat (char **dest, CONST char *src);
2.6 timbl 46: </PRE>
2.1 timbl 47:
2.17 frystyk 48: <H2><A NAME="utils">Case-insensitive String Comparison</A></H2>
2.9 frystyk 49:
50: The usual routines (comp instead of cmp) had some problem.
2.7 luotonen 51:
52: <PRE>
2.23 frystyk 53: extern int strcasecomp (CONST char *a, CONST char *b);
54: extern int strncasecomp (CONST char *a, CONST char *b, int n);
2.7 luotonen 55: </PRE>
56:
2.24 frystyk 57: <H2>String Comparison with Wild Card Match</H2>
58:
59: String comparison function for file names with one wildcard * in the
60: template. Arguments are:
61:
62: <DL>
63: <DT>tmpl
64: <DD>is a template string to match the name against. agaist, may
65: contain a single wildcard character * which matches zero or more
66: arbitrary characters.
67: <DT>name
68: <DD>is the name to be matched agaist the template.
69: </DL>
70:
71: returns YES, if filename matches the template, else NO
72:
73: <PRE>
2.25 ! frystyk 74: extern BOOL HTStrMatch (CONST char * tmpl, CONST char * name);
! 75: extern BOOL HTStrCaseMatch (CONST char * tmpl, CONST char * name);
2.24 frystyk 76: </PRE>
77:
2.9 frystyk 78: <H2>Case-insensitive strstr</H2>
2.7 luotonen 79:
2.9 frystyk 80: This works like <CODE>strstr()</CODE> but is not case-sensitive.
2.1 timbl 81:
2.9 frystyk 82: <PRE>
2.24 frystyk 83: extern char * strcasestr (char * s1, char * s2);
2.17 frystyk 84: </PRE>
85:
86: <H2>Strip white space off a string</H2>
87:
88: Return value points to first non-white character, or to '/0' if
89: none. All trailing white space is OVERWRITTEN with zero.
90:
91: <PRE>
2.24 frystyk 92: extern char * HTStrip (char * s);
2.6 timbl 93: </PRE>
2.9 frystyk 94:
2.14 frystyk 95: <PRE>
2.9 frystyk 96: #endif
97: </PRE>
2.14 frystyk 98:
99: End of declaration module
2.1 timbl 100:
2.6 timbl 101: </BODY>
2.9 frystyk 102: </HTML>
Webmaster