a523b882e0d6dc3feaee81210c92f6d82d52fe5d
[protos/libecoli.git] / include / ecoli_string.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2016, Olivier MATZ <zer0@droids-corp.org>
3  */
4
5 #ifndef ECOLI_STRING_
6 #define ECOLI_STRING_
7
8 #include <stddef.h>
9 #include <stdbool.h>
10
11 /* count the number of identical chars at the beginning of 2 strings */
12 size_t ec_strcmp_count(const char *s1, const char *s2);
13
14 /* return 1 if 's' starts with 'beginning' */
15 int ec_str_startswith(const char *s, const char *beginning);
16
17 /* like asprintf, but use libecoli allocator */
18 int ec_asprintf(char **buf, const char *fmt, ...);
19
20 /* like vasprintf, but use libecoli allocator */
21 int ec_vasprintf(char **buf, const char *fmt, va_list ap);
22
23 /* return true if string is only composed of spaces (' ', '\n', ...) */
24 bool ec_str_is_space(const char *s);
25
26 #endif