本文整理汇总了C++中TextBreakIterator::following方法的典型用法代码示例。如果您正苦于以下问题:C++ TextBreakIterator::following方法的具体用法?C++ TextBreakIterator::following怎么用?C++ TextBreakIterator::following使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextBreakIterator
的用法示例。
在下文中一共展示了TextBreakIterator::following方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findNextWordFromIndex
int findNextWordFromIndex(const UChar* chars, int len, int position, bool forward)
{
TextBreakIterator* it = wordBreakIterator(chars, len);
if (forward) {
position = it->following(position);
while (position != TextBreakDone) {
// We stop searching when the character preceeding the break
// is alphanumeric.
if (position < len && isAlphanumeric(chars[position - 1]))
return position;
position = it->following(position);
}
return len;
} else {
position = it->preceding(position);
while (position != TextBreakDone) {
// We stop searching when the character following the break
// is alphanumeric.
if (position > 0 && isAlphanumeric(chars[position]))
return position;
position = it->preceding(position);
}
return 0;
}
}
示例2: getWordBoundary
Dart_Handle Paragraph::getWordBoundary(unsigned offset) {
String text;
int start = 0, end = 0;
for (RenderObject* object = m_renderView.get(); object;
object = object->nextInPreOrder()) {
if (!object->isText())
continue;
RenderText* renderText = toRenderText(object);
text.append(renderText->text());
}
TextBreakIterator* it = wordBreakIterator(text, 0, text.length());
if (it) {
end = it->following(offset);
if (end < 0)
end = it->last();
start = it->previous();
}
Dart_Handle result = Dart_NewList(2);
Dart_ListSetAt(result, 0, ToDart(start));
Dart_ListSetAt(result, 1, ToDart(end));
return result;
}
示例3: findWordBoundary
void findWordBoundary(const UChar* chars, int len, int position, int* start, int* end)
{
TextBreakIterator* it = wordBreakIterator(chars, len);
*end = it->following(position);
if (*end < 0)
*end = it->last();
*start = it->previous();
}
示例4: findWordEndBoundary
int findWordEndBoundary(const UChar* chars, int len, int position)
{
TextBreakIterator* it = wordBreakIterator(chars, len);
int end = it->following(position);
return end < 0 ? it->last() : end;
}