blob: 0ffa2b3a315f41f47d4e06a6ae5d0d198c27e5a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
/* See LICENSE file for copyright and license details. */
#ifndef __STRING2_H__
#define __STRING2_H__
#include <string.h>
char **strsplit(char *str, char delim, int *size);
#define strstarts(str, prefix) (strncmp(str, prefix, strlen(prefix)) == 0)
static int
strends(const char *str, const char *suffix)
{
int offset = strlen(str) - strlen(suffix);
return offset < 0 ? 0 : strcmp(str + offset, suffix) == 0;
}
#endif /* __STRING2_H__ */
|