class Core::Text::GraphemeIterator

Overview

Iterates grapheme cluster boundaries (UAX #29) of a UTF-16 string. More…

#include <coregraphemeiterator.h>

class GraphemeIterator
{
public:
    // construction

    GraphemeIterator(UStringPtr text, int length, int position = 0);

    // methods

    int getPosition() const;
    void setPosition(int position);
    bool isStart() const;
    bool isEnd() const;
    int next();
    int previous();
};

Detailed Documentation

Iterates grapheme cluster boundaries (UAX #29) of a UTF-16 string.

Treats emoji with modifiers, ZWJ sequences, flags, and combining marks as atomic units. The position is given in UTF-16 code units.

Methods

int next()

Move to next grapheme cluster boundary, returns new position.

int previous()

Move to previous grapheme cluster boundary, returns new position.