Ussd.Wordwrap (Ussd v0.2.0)

Copy Markdown View Source

Splits long text into width-wide chunks for truncate/1.

Not a byte-for-byte port of PHP's wordwrap() - this treats every run of whitespace (including newlines) as breakable, then greedily packs words back into lines up to width characters, hard-splitting any single word longer than width.

Summary

Functions

chunks(content, width)

@spec chunks(String.t(), pos_integer()) :: [String.t()]