Table of Contents

Struct WordEnumerator

Namespace
Egami.Fonts.Unicode
Assembly
Egami.Fonts.dll

Enumerates the segments between word boundaries; get one from Words(ReadOnlySpan<char>).

public ref struct WordEnumerator
Inherited Members

Examples

// A family emoji is one grapheme cluster of eight UTF-16 units; "can't" is one word.
string text = "\uD83D\uDC68\u200D\uD83D\uDC69\u200D\uD83D\uDC67 can't stop";
var graphemes = new List<TextSegment>();
foreach (TextSegment grapheme in TextSegmenter.Graphemes(text))
{
    graphemes.Add(grapheme);
}

var words = new List<string>();
foreach (TextSegment word in TextSegmenter.Words(text))
{
    words.Add(text.Substring(word.Start, word.Length));
}

bool inside = TextSegmenter.IsGraphemeBoundary(text, 2); // false: inside the family

Properties

Current

Gets the current segment.

public readonly TextSegment Current { get; }

Property Value

TextSegment

Methods

GetEnumerator()

Returns this enumerator, for foreach.

public readonly WordEnumerator GetEnumerator()

Returns

WordEnumerator

This enumerator.

MoveNext()

Moves to the next segment.

public bool MoveNext()

Returns

bool

false at the end of the text.