Help us shape the future of Go! Take the 2026 Go Developer Survey

wrap

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: MIT Imports: 5 Imported by: 137

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(b []byte, limit int) []byte

Bytes is shorthand for declaring a new default Wrap instance, used to immediately wrap a byte slice.

func String

func String(s string, limit int) string

String is shorthand for declaring a new default Wrap instance, used to immediately wrap a string.

Types

type Wrap

type Wrap struct {
	Limit         int
	Newline       []rune
	KeepNewlines  bool
	PreserveSpace bool
	TabWidth      int
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(limit int) *Wrap

NewWriter returns a new instance of a wrapping writer, initialized with default settings.

func (*Wrap) Bytes

func (w *Wrap) Bytes() []byte

Bytes returns the wrapped result as a byte slice.

func (*Wrap) String

func (w *Wrap) String() string

String returns the wrapped result as a string.

func (*Wrap) Write

func (w *Wrap) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

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