Skip to main content

wrap

Function wrap 

Source
pub fn wrap(text: &str, width: usize) -> String
Expand description

Greedy hard wrap at width, breaking on spaces — the JS (?![^\n]{1,w}$)([^\n]{1,w})\s replace. A word longer than width is left intact rather than split.