27 lines
726 B
C
27 lines
726 B
C
|
|
#include <blue/core/stringstream.h>
|
||
|
|
#include <blue/object/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));
|
||
|
|
|
||
|
|
b_string_iterator it;
|
||
|
|
const char *delims[] = {"в"};
|
||
|
|
size_t nr_delims = sizeof delims / sizeof delims[0];
|
||
|
|
|
||
|
|
b_string_tokenise(str, delims, nr_delims, 0, &it);
|
||
|
|
while (b_string_iterator_is_valid(&it)) {
|
||
|
|
printf("%s\n", it.string_value);
|
||
|
|
b_string_iterator_next(&it);
|
||
|
|
}
|
||
|
|
|
||
|
|
return 0;
|
||
|
|
}
|