text

package
v0.0.0-...-205059d Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2017 License: Apache-2.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package text provides common text handling capabilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Writer

func Writer(to func(string) error) io.WriteCloser

Writer returns a io writer that collects lines out of a stream and hands them to the supplied function.

Types

type LimitWriter

type LimitWriter struct {
	// contains filtered or unexported fields
}

LimitWriter limits the length of string written through it.

func NewLimitWriter

func NewLimitWriter(to io.Writer, limit int, elisionMarker string) *LimitWriter

NewLimitWriter returns an io.Writer that limits the amount of text written through it and optionally adds a marker if it causes the limit to be reached.

func (*LimitWriter) Flush

func (w *LimitWriter) Flush() error

Flush any writes to the underlying stream. It also makes the writer assume the limit has been reached for the purpose of any further writes.

func (*LimitWriter) Write

func (w *LimitWriter) Write(data []byte) (int, error)

Write will write as much of the string as it can to the underlying writer, if he total number of runes written would exceed the limit, the last part of the string is replaced by the elisionMarker. This method may buffer data, you must call Flush for it all to appear in the underlying stream.

Directories

Path Synopsis
examples/calc command
generator
Package generator provides the functionality used by the lingo command to add generated parser functionality based on syntactically correct go code.
Package generator provides the functionality used by the lingo command to add generated parser functionality based on syntactically correct go code.
Package parse provides support functionality for writing scannerless parsers.
Package parse provides support functionality for writing scannerless parsers.
Package reflow supports rewriting the whitespace in a stream of runes.
Package reflow supports rewriting the whitespace in a stream of runes.

Jump to

Keyboard shortcuts

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