Transformer implements the transform.Transformer interface.
ttransform.SpanningTransformer
Bytes returns a new byte slice with the result of converting b using t. It
calls Reset on t. It returns nil if any error was found. This can only happen
if an error-producing Transformer is passed to If.
( T) Reset()( T) Span(b []byte, atEOF bool) (n int, err error)
String returns a string with the result of converting s using t. It calls
Reset on t. It returns the empty string if any error was found. This can only
happen if an error-producing Transformer is passed to If.
( T) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error)
T : golang.org/x/text/transform.SpanningTransformer
T : golang.org/x/text/transform.Transformer
T : vendor/golang.org/x/text/transform.SpanningTransformer
T : vendor/golang.org/x/text/transform.Transformer
func If(s Set, tIn, tNotIn transform.Transformer) Transformer
func Map(mapping func(rune) rune) Transformer
func Remove(s Set) Transformer
func ReplaceIllFormed() Transformer
// current check to perform
ffunc(rune) bool
// current transformer to use
tIntransform.SpanningTransformertNotIntransform.SpanningTransformer
Reset implements transform.Transformer.
This implementation of Span doesn't help all too much, but it needs to be
there to satisfy this package's Transformer interface.
TODO: there are certainly room for improvements, though. For example, if
t.t == transform.Nop (which will a common occurrence) it will save a bundle
to special-case that loop.
(*T) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error)(*T) is(r rune) bool(*T) isNot(r rune) bool
*T : golang.org/x/text/transform.SpanningTransformer
*T : golang.org/x/text/transform.Transformer
*T : vendor/golang.org/x/text/transform.SpanningTransformer
*T : vendor/golang.org/x/text/transform.Transformer
Transformertransform.Transformer
Reset resets the state and allows a Transformer to be reused.
( T) Span(src []byte, atEOF bool) (n int, err error)
Transform writes to dst the transformed bytes read from src, and
returns the number of dst bytes written and src bytes read. The
atEOF argument tells whether src represents the last bytes of the
input.
Callers should always process the nDst bytes produced and account
for the nSrc bytes consumed before considering the error err.
A nil error means that all of the transformed bytes (whether freshly
transformed from src or left over from previous Transform calls)
were written to dst. A nil error can be returned regardless of
whether atEOF is true. If err is nil then nSrc must equal len(src);
the converse is not necessarily true.
ErrShortDst means that dst was too short to receive all of the
transformed bytes. ErrShortSrc means that src had insufficient data
to complete the transformation. If both conditions apply, then
either error may be returned. Other than the error conditions listed
here, implementations are free to report other errors that arise.
T : golang.org/x/text/transform.SpanningTransformer
T : golang.org/x/text/transform.Transformer
T : vendor/golang.org/x/text/transform.SpanningTransformer
T : vendor/golang.org/x/text/transform.Transformer
( T) Reset()
Span implements transform.Spanner.
Transform implements transform.Transformer.
T : golang.org/x/text/transform.SpanningTransformer
T : golang.org/x/text/transform.Transformer
T : vendor/golang.org/x/text/transform.SpanningTransformer
T : vendor/golang.org/x/text/transform.Transformer
( T) Reset()
Span implements transform.Spanner.
Transform implements transform.Transformer.
T : golang.org/x/text/transform.SpanningTransformer
T : golang.org/x/text/transform.Transformer
T : vendor/golang.org/x/text/transform.SpanningTransformer
T : vendor/golang.org/x/text/transform.Transformer
Package-Level Functions (total 7, all are exported)
If returns a transformer that applies tIn to consecutive runes for which
s.Contains(r) and tNotIn to consecutive runes for which !s.Contains(r). Reset
is called on tIn and tNotIn at the start of each run. A Nop transformer will
substitute a nil value passed to tIn or tNotIn. Invalid UTF-8 is translated
to RuneError to determine which transformer to apply, but is passed as is to
the respective transformer.
In creates a Set with a Contains method that returns true for all runes in
the given RangeTable.
Map returns a Transformer that maps the runes in the input using the given
mapping. Illegal bytes in the input are converted to utf8.RuneError before
being passed to the mapping func.
In creates a Set with a Contains method that returns true for all runes not
in the given RangeTable.
Predicate creates a Set with a Contains method that returns f(r).
Remove returns a Transformer that removes runes r for which s.Contains(r).
Illegal input bytes are replaced by RuneError before being passed to f.
ReplaceIllFormed returns a transformer that replaces all input bytes that are
not part of a well-formed UTF-8 code sequence with utf8.RuneError.
Package-Level Constants (only one, which is unexported)
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.