Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spenserblack/go-wordwrap
Wraps words with a given limit
https://github.com/spenserblack/go-wordwrap
go golang word-wrap wordwrap
Last synced: about 1 month ago
JSON representation
Wraps words with a given limit
- Host: GitHub
- URL: https://github.com/spenserblack/go-wordwrap
- Owner: spenserblack
- License: mit
- Created: 2021-09-13T13:43:46.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-07-24T11:42:59.000Z (over 1 year ago)
- Last Synced: 2023-07-27T22:38:25.247Z (over 1 year ago)
- Topics: go, golang, word-wrap, wordwrap
- Language: Go
- Homepage:
- Size: 43 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `wordwrap`
[![CI](https://github.com/spenserblack/go-wordwrap/actions/workflows/ci.yml/badge.svg)](https://github.com/spenserblack/go-wordwrap/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/spenserblack/go-wordwrap/branch/master/graph/badge.svg?token=4SMgf9x2vv)](https://codecov.io/gh/spenserblack/go-wordwrap)
[![Go Report Card](https://goreportcard.com/badge/github.com/spenserblack/go-wordwrap)](https://goreportcard.com/report/github.com/spenserblack/go-wordwrap)
[![Go Reference](https://pkg.go.dev/badge/github.com/spenserblack/go-wordwrap.svg)](https://pkg.go.dev/github.com/spenserblack/go-wordwrap)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
```go
lines := wordwrap.WordWrap("this test-string has been successfully wrapped successfully", 10)
for _, line := range lines {
fmt.Println(line)
}
```### Output
```console
this test-
string has
been
successful
ly wrapped
successful
ly
```