blob: 6fa76d34a99caf497bbb4fd9be91f9141cdc0467 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include <stdio.h>
#define i_import // cstr + utf8 functions
#include <stc/cregex.h>
#define i_implement
#include <stc/csubstr.h>
int main(void)
{
puts("Split with c_fortoken (csubstr):");
c_fortoken (i, "Hello World C99!", " ")
printf("'%.*s'\n", c_SS(i.token));
puts("\nSplit with c_formatch (regex):");
cregex re = cregex_from("[^ ]+");
c_formatch (i, &re, " Hello World C99! ")
printf("'%.*s'\n", c_SS(i.match[0]));
cregex_drop(&re);
}
|