Files
bluelib/test/ds/unicode-strings.c

27 lines
685 B
C
Raw Normal View History

2025-09-22 10:55:20 +01:00
#include <blue/core/stringstream.h>
#include <blue/ds/string.h>
2025-09-22 10:55:20 +01:00
#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];
2025-11-01 10:04:41 +00:00
b_iterator *it = b_string_tokenise(str, delims, nr_delims, 0);
b_foreach(const char *, tok, it)
{
printf("%s\n", tok);
2025-09-22 10:55:20 +01:00
}
2025-11-01 10:04:41 +00:00
b_iterator_unref(it);
2025-09-22 10:55:20 +01:00
return 0;
}