C Standard Library Extensions  1.1.2
cxstrutils.h
1 /* $Id: cxstrutils.h,v 1.6 2011-02-21 14:15:31 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: rpalsa $
23  * $Date: 2011-02-21 14:15:31 $
24  * $Revision: 1.6 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifndef CX_STRUTILS_H
29 #define CX_STRUTILS_H
30 
31 #include <stdarg.h>
32 #include <cxtypes.h>
33 
34 CX_BEGIN_DECLS
35 
36 /*
37  * String comparison functions.
38  */
39 
40 cxint cx_strcasecmp(const cxchar *, const cxchar *);
41 cxint cx_strncasecmp(const cxchar *, const cxchar *, cxsize);
42 cxint cx_strempty(const cxchar *, const cxchar *);
43 
44 
45 /*
46  * Utility functions modifing their string argument
47  */
48 
49 cxchar *cx_strlower(cxchar *);
50 cxchar *cx_strupper(cxchar *);
51 
52 cxchar *cx_strtrim(cxchar *);
53 cxchar *cx_strrtrim(cxchar *);
54 cxchar *cx_strstrip(cxchar *);
55 
56 
57 /*
58  * Utility functions which do not create a new string
59  */
60 
61 cxchar *cx_strskip(const cxchar *, cxint (*)(cxint));
62 
63 
64 /*
65  * Utilities returning a newly allocated string.
66  */
67 
68 cxchar *cx_strdup(const cxchar *);
69 cxchar *cx_strndup(const cxchar *, cxsize);
70 cxchar *cx_strvdupf(const cxchar *, va_list) CX_GNUC_PRINTF(1, 0);
71 
72 cxchar *cx_stpcpy(cxchar *, const cxchar *);
73 
74 cxchar **cx_strsplit(const cxchar *, const cxchar *, cxint);
75 void cx_strfreev(cxchar **sarray);
76 
77 cxchar *cx_strjoinv(const cxchar *, cxchar **);
78 
79 CX_END_DECLS
80 
81 #endif /* CX_STRUTILS_H */