Wraps words at a given limit. Wraps at whitespace, hyphens (-
), and will wrap words that exceed
the given limit. See package documentation for more details.
lines := wordwrap.WordWrap("this test-string has been successfully wrapped successfully", 10)
for _, line := range lines {
fmt.Println(line)
}
this test-
string has
been
successful
ly wrapped
successful
ly