X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fecoli_string.h;fp=include%2Fecoli_string.h;h=a523b882e0d6dc3feaee81210c92f6d82d52fe5d;hb=18d03456d96f7a086a2ccc82ce97fcf056848d90;hp=0000000000000000000000000000000000000000;hpb=a1571d413d2acac5d4a4fbdf2e50b2d1a6da3aa6;p=protos%2Flibecoli.git diff --git a/include/ecoli_string.h b/include/ecoli_string.h new file mode 100644 index 0000000..a523b88 --- /dev/null +++ b/include/ecoli_string.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2016, Olivier MATZ + */ + +#ifndef ECOLI_STRING_ +#define ECOLI_STRING_ + +#include +#include + +/* count the number of identical chars at the beginning of 2 strings */ +size_t ec_strcmp_count(const char *s1, const char *s2); + +/* return 1 if 's' starts with 'beginning' */ +int ec_str_startswith(const char *s, const char *beginning); + +/* like asprintf, but use libecoli allocator */ +int ec_asprintf(char **buf, const char *fmt, ...); + +/* like vasprintf, but use libecoli allocator */ +int ec_vasprintf(char **buf, const char *fmt, va_list ap); + +/* return true if string is only composed of spaces (' ', '\n', ...) */ +bool ec_str_is_space(const char *s); + +#endif