-
-
Save roxlu/7d73f8928e7e8489ae65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unicode/uchriter.h> | |
#include <unicode/schriter.h> | |
#include <unicode/ustring.h> | |
#include <stdio.h> | |
#include <unicode/ustdio.h> | |
#include <unicode/brkiter.h> | |
#include <stdlib.h> | |
using namespace poly; | |
int main() { | |
UnicodeString ts("綧緁緅 襏襆贂 峷敊浭"); | |
const UChar* ts_ptr = ts.getTerminatedBuffer(); | |
UBreakIterator* bi = NULL; | |
int32_t p = 0; | |
UErrorCode err = U_ZERO_ERROR; | |
bi = ubrk_open(UBRK_CHARACTER, 0, ts_ptr, u_strlen(ts_ptr), &err); | |
if (U_FAILURE(err)) { | |
printf("Error: failed to create a break iterator."); | |
return -1; | |
} | |
p = ubrk_first(bi); | |
while (p != UBRK_DONE) { | |
printf("Boundary at position: %d\n", p); | |
p = ubrk_next(bi); | |
} | |
ubrk_close(bi); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment