linebreak

package module
v0.0.0-...-d8f3725 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2018 License: MIT Imports: 1 Imported by: 3

Documentation

Overview

Package linebreak wraps text at a given width

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Greedy

func Greedy(text string, width, maxwidth int) string

Greedy formats text at the given width greedily

func Wrap

func Wrap(text string, width, maxwidth int) string

Wrap formats text at the given width in linear time

Example
text := "a b c d e f g h i j k l m n o p qqqqqqqqq"
width := 9
textWrapped := linebreak.Wrap(text, width, width)

fmt.Println(textWrapped)
Output:

a b c d
e f g h
i j k l
m n o p
qqqqqqqqq

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL