Documentation
¶
Overview ¶
Package text provides common text handling capabilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
|
|
|
examples/cstcalc
command
|
|
|
examples/simplecalc
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. |