LAL 7.7.0.1-678514e
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
28extern "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
40int XLALStringPrint(char *s, size_t n, const char *fmt, ...) _LAL_GCC_PRINTF_FORMAT_(3,4);
41char *XLALStringAppend(char *s, const char *append);
42char *XLALStringAppendFmt(char *s, const char *fmt, ...) _LAL_GCC_PRINTF_FORMAT_(2,3);
43char *XLALStringDuplicate(const char *s);
44size_t XLALStringCopy(char *dst, const char *src, size_t size);
45size_t XLALStringConcatenate(char *dst, const char *src, size_t size);
46int XLALStringToLowerCase(char * string);
47int XLALStringToUpperCase(char * string);
48int XLALStringCaseCompare(const char *s1, const char *s2);
49int XLALStringNCaseCompare(const char *s1, const char *s2, size_t n);
50char *XLALStringCaseSubstring(const char *haystack, const char *needle);
51char *XLALStringToken(char **s, const char *delim, int empty);
52char *XLALStringTranslate(char *s, int (*f)(int, void*), void *param);
53char *XLALStringStripChars(char *s, int (*f)(int));
54char *XLALStringKeepChars(char *s, int (*f)(int));
55char *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
int XLALStringToLowerCase(char *string)
Turn a string in-place into lowercase without using locale-dependent functions.
Definition: LALString.c:153
char * XLALStringStripChars(char *s, int(*f)(int))
Return the string 's' with all characters for which 'f()' is true removed.
Definition: LALString.c:354
char char * XLALStringDuplicate(const char *s)
Like strdup but uses LAL allocation routines (free with LALFree).
Definition: LALString.c:89
int XLALStringCaseCompare(const char *s1, const char *s2)
Compare two strings, ignoring case and without using locale-dependent functions.
Definition: LALString.c:210
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
int char * XLALStringAppend(char *s, const char *append)
Like strcat but dynamically reallocates string with LALRealloc.
Definition: LALString.c:50
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
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
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
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
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
int XLALStringToUpperCase(char *string)
Turn a string in-place into uppercase without using locale-dependent functions.
Definition: LALString.c:182
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