Documentation ¶
Index ¶
- func Contains(s, substr Runes) bool
- func ContainsAny(s, substr Runes) bool
- func Equal(s1, s2 Runes) bool
- func HasPrefix(r Runes, pre Runes) bool
- func HasSuffix(s, suffix Runes) bool
- func Index(r Runes, s Runes) int
- func IndexAny(r Runes, s Runes) int
- func IndexFunc(r Runes, f func(rune) bool) int
- func LastIndex(r, s Runes) int
- func LastIndexAny(r Runes, s Runes) int
- func LastIndexFunc(r Runes, f func(rune) bool) int
- type Builder
- type Reader
- type Runes
- func Chunk(r Runes, n int) (out []Runes)
- func Fields(src Runes) (out []Runes)
- func Join(slice []Runes, sep Runes) (out Runes)
- func Map(mapping func(rune) rune, s Runes) Runes
- func Replace(src, matchString, replaceString Runes, n int) (out Runes)
- func ReplaceAll(src, matchString, replaceString Runes) (out Runes)
- func ReplaceBlocks(src, first, last, replaceString Runes, n int) (out Runes)
- func ReplaceBlocksAll(src, first, last, replaceString Runes) (out Runes)
- func ReplaceBlocksFunc(src, first, last Runes, handler func(Runes) Runes, n int) (out Runes)
- func ReplaceBlocksFuncAll(src, first, last Runes, handler func(Runes) Runes) (out Runes)
- func Split(r Runes, sep Runes) (out []Runes)
- func SplitIntoBlocks(src, first, last Runes) (out []Runes)
- func TrimFunc(s Runes, f func(rune) bool) Runes
- func TrimSpace(r Runes) Runes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsAny ¶
ContainsAny returns true if any rune in substr occurs in s.
func IndexFunc ¶
IndexFunc returns the index of first rune in r that satisfies condition given by f.
func LastIndexAny ¶
LastIndexAny returns the last index of any of the runes appearing in s.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is for building Runes.
func (*Builder) WriteRunes ¶
WriteRunes appends r to b. Returns the length of n and error (currently always nil).
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is an io.Reader reading from s.
func (*Reader) Read ¶
Read implements io.Reader interface. It reads one rune at a time so don't expect to be able to read a sequence of single bytes. Most of the time, you probaly want ReadRune.
func (*Reader) ReadRune ¶
ReadRune implements io.RuneReader interface. For compatibility only. Most of the time, you probaly want ReadRune.
func (*Reader) ReadRuneAt ¶
ReadRuneAt returns rune at r[off]. If off is outside the range of r, returns appropriate error.
type Runes ¶
type Runes []rune
Runes is an alias for []rune.
func Replace ¶
Replace replaces the first n instances of matchString in src with replaceString. If n<0, it replaces all. Returns src if n=0.
func ReplaceAll ¶
ReplaceAll replaces all instances of matchString in src with replaceString.
func ReplaceBlocks ¶
ReplaceBlocks replaces the first n blocks defined by first-last pair by replaceString. If n=-1, all are replaced. If n=0, returns src.
func ReplaceBlocksAll ¶
ReplaceBlocksAll replaces all blocks.
func ReplaceBlocksFunc ¶
ReplaceBlocksFunc replaces the content of blocks defined by first and last with the output of handler.
func ReplaceBlocksFuncAll ¶
ReplaceBlocksFuncAll replaces all blocks with output of handler.
func SplitIntoBlocks ¶
SplitIntoBlocks splits src into two types of chunks: those that match the block as defined by first and last, and those that do not. The result is returned as a slice of Runes. A block will always terminate at the first instance of last so none of the block related functions in this package will work with nested blocks.