StringUtils.h 940 Bytes
Newer Older
Hisham Muhammad's avatar
Hisham Muhammad committed
1
/* Do not edit this file. It was automatically generated. */
Hisham Muhammad's avatar
Hisham Muhammad committed
2

David Hunt's avatar
David Hunt committed
3
4
#ifndef HEADER_StringUtils
#define HEADER_StringUtils
Hisham Muhammad's avatar
Hisham Muhammad committed
5
/*
Hisham Muhammad's avatar
Hisham Muhammad committed
6
htop - StringUtils.h
Hisham Muhammad's avatar
Hisham Muhammad committed
7
(C) 2004-2011 Hisham H. Muhammad
Hisham Muhammad's avatar
Hisham Muhammad committed
8
9
10
11
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/

12
13
#include <stdio.h>

Explorer09's avatar
Explorer09 committed
14
#define String_startsWith(s, match) (strncmp((s),(match),strlen(match)) == 0)
15
#define String_contains_i(s1, s2) (strcasestr(s1, s2) != NULL)
16

Explorer09's avatar
Explorer09 committed
17
18
19
20
21
/*
 * String_startsWith gives better performance if strlen(match) can be computed
 * at compile time (e.g. when they are immutable string literals). :)
 */

Hisham Muhammad's avatar
Hisham Muhammad committed
22
char* String_cat(const char* s1, const char* s2);
Hisham Muhammad's avatar
Hisham Muhammad committed
23

Hisham Muhammad's avatar
Hisham Muhammad committed
24
char* String_trim(const char* in);
Hisham Muhammad's avatar
Hisham Muhammad committed
25

26
extern int String_eq(const char* s1, const char* s2);
Hisham Muhammad's avatar
Hisham Muhammad committed
27

28
char** String_split(const char* s, char sep, int* n);
Hisham Muhammad's avatar
Hisham Muhammad committed
29
30
31

void String_freeArray(char** s);

Hisham Muhammad's avatar
Hisham Muhammad committed
32
33
char* String_getToken(const char* line, const unsigned short int numMatch);

34
35
char* String_readLine(FILE* fd);

Hisham Muhammad's avatar
Hisham Muhammad committed
36
#endif