C Standard Library Extensions  1.2.0
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 */
cxchar * cx_strstrip(cxchar *)
Remove leading and trailing whitespace characters from a string.
Definition: cxstrutils.c:450
cxint cx_strcasecmp(const cxchar *, const cxchar *)
Compare two strings ignoring the case of ASCII characters.
Definition: cxstrutils.c:211
cxchar * cx_strndup(const cxchar *, cxsize)
Duplicate the first n charactes of a string.
Definition: cxstrutils.c:530
cxchar * cx_strupper(cxchar *)
Convert all lowercase characters in a string into uppercase characters.
Definition: cxstrutils.c:373
cxchar cxchar * cx_stpcpy(cxchar *, const cxchar *)
Copy a string returning a pointer to its end.
Definition: cxstrutils.c:596
cxchar * cx_strtrim(cxchar *)
Remove leading whitespace characters from a string.
Definition: cxstrutils.c:404
cxchar * cx_strrtrim(cxchar *)
Remove trailing whitespace characters from a string.
Definition: cxstrutils.c:427
cxint cx_strempty(const cxchar *, const cxchar *)
Test if a string represents an empty string.
Definition: cxstrutils.c:306
cxchar * cx_strvdupf(const cxchar *format, va_list args)
Create a string from a variable-length argument list under format control.
Definition: cxstrutils.c:564
cxchar * cx_strdup(const cxchar *)
Duplicate a string.
Definition: cxstrutils.c:505
cxchar * cx_strskip(const cxchar *, cxint(*)(cxint))
Locate the first character in a string that does not belong to a given character class.
Definition: cxstrutils.c:480
cxint cx_strncasecmp(const cxchar *, const cxchar *, cxsize)
Compare the first n characters of two strings ignoring the case of ASCII characters.
Definition: cxstrutils.c:254
cxchar * cx_strlower(cxchar *)
Convert all uppercase characters in a string into lowercase characters.
Definition: cxstrutils.c:340
cxchar ** cx_strsplit(const cxchar *, const cxchar *, cxint)
Split a string into pieces at a given delimiter.
Definition: cxstrutils.c:662
void cx_strfreev(cxchar **sarray)
Deallocate a NULL terminated string array.
Definition: cxstrutils.c:617
cxchar * cx_strjoinv(const cxchar *, cxchar **)
Join strings from an array of strings.
Definition: cxstrutils.c:744