diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-10-25 16:54:44 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-10-25 16:54:44 (GMT) |
commit | 413aa06d8f4037579cb6718e51bd7488a153f7e9 (patch) | |
tree | 5e4ef13849c8131bdef306ad688963e4181d3793 /src/common/extstr.h | |
parent | 5acd4ab2dd059c81a333ed630686f6aa78f38a1e (diff) |
Extended the facilities to search for prefixes or suffixes in strings.
Diffstat (limited to 'src/common/extstr.h')
-rw-r--r-- | src/common/extstr.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/common/extstr.h b/src/common/extstr.h index 5af572b..0a89639 100644 --- a/src/common/extstr.h +++ b/src/common/extstr.h @@ -64,8 +64,14 @@ char *escape_crlf(char *); /* Borne la taille d'une chaîne à une valeur donnée. */ char *ellipsis(char *, size_t); +/* Détermine si une chaîne débute par une autre. */ +bool _startswith(const char *, const char *, const char **); + /* Détermine si une chaîne se termine par une autre. */ -bool endswith(const char *, const char *); +bool _endswith(const char *, const char *, const char **); + +#define startswith(str, prefix) _startswith(str, prefix, NULL) +#define endswith(str, suffix) _endswith(str, suffix, NULL) |