LAL  7.5.0.1-bede9b2
LALString.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2015, 2016 Karl Wette
3 * Copyright (C) 2007 Jolien Creighton
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with with program; see the file COPYING. If not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301 USA
19 */
20 
21 #ifndef _LALSTRING_H
22 #define _LALSTRING_H
23 
24 #include <stddef.h>
25 #include <lal/LALAtomicDatatypes.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #elif 0
30 } /* so that editors will match preceding brace */
31 #endif
32 
33 /**
34  * \defgroup LALString_h Header LALString.h
35  * \ingroup lal_std
36  * \author Creighton, J. D. E.
37  * \brief XLAL string manipulation routines.
38  *//** @{ */
39 
40 int XLALStringPrint(char *s, size_t n, const char *fmt, ...) _LAL_GCC_PRINTF_FORMAT_(3,4);
41 char *XLALStringAppend(char *s, const char *append);
42 char *XLALStringAppendFmt(char *s, const char *fmt, ...) _LAL_GCC_PRINTF_FORMAT_(2,3);
43 char *XLALStringDuplicate(const char *s);
44 size_t XLALStringCopy(char *dst, const char *src, size_t size);
45 size_t XLALStringConcatenate(char *dst, const char *src, size_t size);
46 int XLALStringToLowerCase(char * string);
47 int XLALStringToUpperCase(char * string);
48 int XLALStringCaseCompare(const char *s1, const char *s2);
49 int XLALStringNCaseCompare(const char *s1, const char *s2, size_t n);
50 char *XLALStringCaseSubstring(const char *haystack, const char *needle);
51 char *XLALStringToken(char **s, const char *delim, int empty);
52 char *XLALStringTranslate(char *s, int (*f)(int, void*), void *param);
53 char *XLALStringStripChars(char *s, int (*f)(int));
54 char *XLALStringKeepChars(char *s, int (*f)(int));
55 char *XLALStringReplaceChar(char *s, const int from, const int to);
56 
57 /** @} */
58 
59 #if 0
60 { /* so that editors will match succeeding brace */
61 #elif defined(__cplusplus)
62 }
63 #endif
64 #endif /* _LALSTRING_H */
#define _LAL_GCC_PRINTF_FORMAT_(NFMT, NARG)
Definition: LALStddef.h:47
static const BufferList empty
static double f(double theta, double y, double xi)
Definition: XLALMarcumQ.c:258
char * XLALStringStripChars(char *s, int(*f)(int))
Return the string 's' with all characters for which 'f()' is true removed.
Definition: LALString.c:354
int XLALStringToLowerCase(char *string)
Turn a string in-place into lowercase without using locale-dependent functions.
Definition: LALString.c:153
char * XLALStringReplaceChar(char *s, const int from, const int to)
Return the string 's' with all characters 'from' replaced with 'to'.
Definition: LALString.c:382
int XLALStringCaseCompare(const char *s1, const char *s2)
Compare two strings, ignoring case and without using locale-dependent functions.
Definition: LALString.c:210
char * XLALStringTranslate(char *s, int(*f)(int, void *), void *param)
Return the string 's' applying the function 'f(c, param)' to all characters 'c'.
Definition: LALString.c:324
int XLALStringPrint(char *s, size_t n, const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(3
size_t XLALStringCopy(char *dst, const char *src, size_t size)
Copy sources string src to destination string dst.
Definition: LALString.c:104
char char * XLALStringDuplicate(const char *s)
Like strdup but uses LAL allocation routines (free with LALFree).
Definition: LALString.c:89
char * XLALStringCaseSubstring(const char *haystack, const char *needle)
Locates substring needle in string haystack, ignoring case and without using locale-dependent functio...
Definition: LALString.c:267
size_t XLALStringConcatenate(char *dst, const char *src, size_t size)
Concatenate sources string src to the end of destination string dst.
Definition: LALString.c:131
char * XLALStringKeepChars(char *s, int(*f)(int))
Return the string 's' with all characters for which 'f()' is false removed.
Definition: LALString.c:368
int char * XLALStringAppend(char *s, const char *append)
Like strcat but dynamically reallocates string with LALRealloc.
Definition: LALString.c:50
char * XLALStringAppendFmt(char *s, const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(2
int XLALStringNCaseCompare(const char *s1, const char *s2, size_t n)
Compare the first N characters of two strings, ignoring case and without using locale-dependent funct...
Definition: LALString.c:219
int XLALStringToUpperCase(char *string)
Turn a string in-place into uppercase without using locale-dependent functions.
Definition: LALString.c:182
char * XLALStringToken(char **s, const char *delim, int empty)
Return the next token delimited by any character in 'delim' from the string 's', which is updated to ...
Definition: LALString.c:292