blob: aab4f03a19792790f65e9e02fa8ff6cb01ec95fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include "stringutil.h"
char*
strend(char* s)
{
if (strlen(s) == 0) return '\0';
while(*s != '\0')
++s;
return --s;
}
bool
endswith(char* s, char* suff)
{
if (strlen(s) < strlen(suff)) return false;
char* a = strend(s)-(strlen(suff)-1);
if (!a) return false;
if (!strcmp(a, suff)) return true;
return false;
}
|