-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.c
44 lines (31 loc) · 858 Bytes
/
test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#define SOB_IMPLEMENTATION
#include "sob.h"
int main()
{
const char * str = "Hey,What'scracking.Done.";
const char * str2 = "Boi,ohBoi!";
sob_t s1 = sob_create_from_cstr(str);
sob_t s2 = sob_create_from_cstr(str2);
//s = sob_triml(&s);
// s1 = sob_trim(&s1);
//sob_swap(&s1, &s2);
//char arr[100];
//sob_copy(&s1, arr, 5);
sob_t s3 = sob_create_from_cstr(str);
const char * sub = "ne";
size_t len = strlen(sub);
//printf("%d\n", sob_ends_with(&s1, sub, len));
size_t i;
while ((i = sob_find(&s1, ".", 1)) != nopos)
s1 = sob_slice(&s1, i + 1, sob_length(&s1) - 1);
/*
size_t x;
if ((x = sob_find(&s1, sub, len)) != nopos) {
printf("%lu\n", x);
} else {
printf("Not found!\n");
}
*/
sob_print(&s1);
return 0;
}