Function
uni_nextbrk
Compute next boundary.
Since v1.0
unistat uni_nextbrk(
Parameters π
boundary | in | Boundary to detect. |
text | in | The text to segment. |
text_len | in | Number of code units in |
text_attr | in | Attributes of |
index | inout | Code point boundary as a code unit offset in |
Return Value π
UNI_OK | If the break iterator was successfully repositioned. |
UNI_DONE | If |
UNI_BAD_OPERATION | If |
UNI_BAD_ENCODING | If |
Discussion π
Compute the next boundary
for text
starting from a known code point specified by code unit index index
. The implementation sets index
to the code unit offset of the next boundary
.
Examples π
This example iterates the extended grapheme clusters of a a UTF-8 encoded string and prints the indices where each grapheme begins.
#include <unicorn.h>
#include <stdio.h>
int main(void)
{
const char *string = u8"Hi, δΈη";
unisize index = 0;
while (uni_nextbrk(UNI_GRAPHEME, string, -1, UNI_UTF8, &index) == UNI_OK)
{
printf("%d\n", index); // prints '1', '2', '3', '4', 7', '10'
}
return 0;
}