Enum WordBreak
Where breaks may fall inside words (CSS word-break).
public enum WordBreak
Fields
BreakAll = 1Letters and digits of any script break like ideographs, between any two.
KeepAll = 2Ideographs, kana and Hangul keep together like the letters of a word, as Korean text with spaces wants.
Normal = 0Unicode's rules: words break at spaces and punctuation, ideographs between any two.
Examples
// Where lines may end: after spaces and hyphens, and always at the end; a line must end after a newline.
List<int> breaks = [];
foreach (LineBreak b in LineBreaks.Enumerate("A well-known fact.\nNext"))
{
breaks.Add(b.Index); // 2, 7, 13, 19 (mandatory), 23
}
// CSS switches: break-all lets letters break like ideographs.
LineBreakOptions breakAll = new(WordBreak: WordBreak.BreakAll);
int count = 0;
foreach (LineBreak b in LineBreaks.Enumerate("word", breakAll))
{
count++; // 4: after every letter
}