linebreak

Implements the Unicode line breaking algorithm.

The algorithm supports line breaking rules for various languages.

Members

Functions

getCharacterClass
CharClass getCharacterClass(dchar ch)
Undocumented in source. Be warned that the author may not have intended to support it.
lineBreakRange
LineBreakRange!string lineBreakRange(string text)

Creates a forward range of breakable text segments.

Structs

LineBreak
struct LineBreak(R)

Represents a single line break opprtunity.

LineBreakRange
struct LineBreakRange(R)

A range of line break opportunities

Examples

import std.algorithm : equal, map;

auto text = "Hello, world!\nThis is an (English) example.";
auto broken = text
	.lineBreakRange
	.map!(lb => lb.text);

assert(broken.equal(["Hello, ", "world!\n", "This ", "is ", "an ", "(English) ", "example."]));

Meta