spenserblack / go-wordwrap

Wraps words with a given limit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wordwrap

CI codecov Go Report Card Go Reference

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.

Example

lines := wordwrap.WordWrap("this test-string has been successfully wrapped successfully", 10)
for _, line := range lines {
	fmt.Println(line)
}

Output

this test-
string has
been
successful
ly wrapped
successful
ly

About

Wraps words with a given limit

License:MIT License


Languages

Language:Go 100.0%