Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CRLF = []byte{'\r', '\n'} LF = []byte{'\n'} )
Functions ¶
func WrapString ¶
func WrapString(s string, opts *WrapOptions) string
WrapString wraps the given string within lim width in characters.
Wrapping is currently naive and only happens at white-space. A future version of the library will implement smarter wrapping. This means that pathological cases can dramatically reach past the limit, such as a very long word. pfx can be set to define a prefix for each new line.
Types ¶
type WrapOptions ¶
type WrapOptions struct { // Linebreak defines the line break used between lines in wordwrap, and // defaults to \n if not set. Linebreak []byte // Maximum characters in a line, will default to 76 if set to zero. Limit int // Prefix is a prefix set on each line if Prefix string // Will break words if set to true BreakWords bool }
func DefaultWrapOptions ¶
func DefaultWrapOptions() *WrapOptions
DefaultWrapOptions returns a WrapOptions object with the default values set.
Click to show internal directories.
Click to hide internal directories.