28 lines
707 B
C
28 lines
707 B
C
#include <blue/core/stringstream.h>
|
|
#include <blue/ds/string.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(void)
|
|
{
|
|
printf("здравс\u26A0твуите\n");
|
|
b_string *str = b_string_create_from_cstr("здравствуите");
|
|
const char *s = b_string_ptr(str);
|
|
printf("%s\n", s);
|
|
printf("len: %zu\n", b_string_get_size(str, B_STRLEN_NORMAL));
|
|
printf("codepoints: %zu\n", b_string_get_size(str, B_STRLEN_CODEPOINTS));
|
|
|
|
const char *delims[] = {"в"};
|
|
size_t nr_delims = sizeof delims / sizeof delims[0];
|
|
|
|
b_iterator *it = b_string_tokenise(str, delims, nr_delims, 0);
|
|
b_foreach(const char *, tok, it)
|
|
{
|
|
printf("%s\n", tok);
|
|
}
|
|
b_iterator_unref(it);
|
|
b_string_unref(str);
|
|
|
|
return 0;
|
|
}
|