Documentation ¶
Index ¶
- func AddPrefix(text, prefix, sep string) string
- func AddPrefixW(w io.StringWriter, text, prefix, sep string) (n int, err error)
- func AddSuffix(text, suffix, sep string) string
- func AddSuffixW(w io.StringWriter, text, suffix, sep string) (n int, err error)
- func Append[B ~byte, S1 ~string, S2 String[B]](s S1, more ...S2) S1
- func Convert[R ~string, B ~byte, S String[B]](s S) R
- func ForEachSection(text, sep string, fn func(section string, hasSep bool) error) (err error)
- func HasPrefix[B1, B2 ~byte, S1 String[B1], S2 String[B2]](s S1, prefix S2) bool
- func HasSuffix[B1, B2 ~byte, S1 String[B1], S2 String[B2]](s S1, suffix S2) bool
- func NoSpace(text string) string
- func NoSpaceW(w io.StringWriter, text string) (n int, err error)
- func RemoveFunc(text string, match func(r rune) bool) string
- func RemoveFuncW(w io.StringWriter, text string, match func(r rune) bool) (n int, err error)
- func RemoveIndent(text, sep string) string
- func RemoveIndentW(w io.StringWriter, text, sep string) (n int, err error)
- func RemovePrefix(text, prefix, sep string) string
- func RemovePrefixW(w io.StringWriter, text, prefix, sep string) (n int, err error)
- func RemoveSpace(text, sep string) string
- func RemoveSpaceW(w io.StringWriter, text, sep string) (n int, err error)
- func RemoveSuffix(text, prefix, sep string) string
- func RemoveSuffixW(w io.StringWriter, text, suffix, sep string) (n int, err error)
- func ReplaceFunc(text string, match func(r rune) bool, replace func(matched string) string) string
- func ReplaceFuncW(w io.StringWriter, text string, match func(r rune) bool, ...) (n int, err error)
- func Reverse[B ~byte, S String[B]](s S) S
- func SliceEnd[B ~byte, S String[B]](s S, i int) S
- func SliceStart[B ~byte, S String[B]](s S, i int) S
- func SliceStartEnd[B ~byte, S String[B]](s S, i, j int) S
- func ToBytes[R, B ~byte, S String[B]](s S) []R
- func TrimPrefix[B1, B2 ~byte, S1 String[B1], S2 String[B2]](s S1, prefix S2) S1
- func TrimSuffix[B1, B2 ~byte, S1 String[B1], S2 String[B2]](s S1, suffix S2) S1
- type ByteString
- type String
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPrefixW ¶ added in v0.12.0
func AddPrefixW(w io.StringWriter, text, prefix, sep string) (n int, err error)
AddPrefixW is like AddPrefix, except it writes the string into the w.
func AddSuffixW ¶ added in v0.12.0
func AddSuffixW(w io.StringWriter, text, suffix, sep string) (n int, err error)
AddSuffixW is like AddSuffix, except it writes the string into the w.
func ForEachSection ¶ added in v0.12.0
ForEachSection runs fn on each section of the text, using sep as the section separator.
func NoSpaceW ¶ added in v0.12.0
func NoSpaceW(w io.StringWriter, text string) (n int, err error)
NoSpaceW is like NoSpace, but writes the string to w.
func RemoveFunc ¶ added in v0.12.0
RemoveFunc returns a copy of text with all matched runes removed.
func RemoveFuncW ¶ added in v0.12.0
RemoveFuncW is like RemoveFunc, but writes the string to w.
NOTE: To do in-place remove, use byteshelper.RemoveFunc.
func RemoveIndent ¶ added in v0.12.0
RemoveIndent drops all leading empty sections, and detects the indentation level from the first non-empty section.
func RemoveIndentW ¶ added in v0.12.0
func RemoveIndentW(w io.StringWriter, text, sep string) (n int, err error)
func RemovePrefix ¶ added in v0.12.0
RemovePrefix removes the prefix from each section of the text.
func RemovePrefixW ¶ added in v0.12.0
func RemovePrefixW(w io.StringWriter, text, prefix, sep string) (n int, err error)
RemovePrefixW is like RemovePrefix, except it writes the string into the w.
func RemoveSpace ¶ added in v0.12.0
RemoveSpace calls strings.TrimSpace on each section of the text.
func RemoveSpaceW ¶ added in v0.12.0
func RemoveSpaceW(w io.StringWriter, text, sep string) (n int, err error)
RemoveSpaceW is like RemoveSpace, except it writes the string into the w.
func RemoveSuffix ¶ added in v0.12.0
RemoveSuffix removes the suffix from each section of the text.
func RemoveSuffixW ¶ added in v0.12.0
func RemoveSuffixW(w io.StringWriter, text, suffix, sep string) (n int, err error)
RemoveSuffixW is like RemoveSuffix, except it writes the string into the w.
func ReplaceFunc ¶ added in v0.12.0
ReplaceFunc returns a copy of the text with all matched strings replaced.
func ReplaceFuncW ¶ added in v0.12.0
func ReplaceFuncW( w io.StringWriter, text string, match func(r rune) bool, replace func(matched string) string, ) (n int, err error)
ReplaceFuncW is like ReplaceFunc, but writes the string to w.
func SliceStart ¶
SliceStart returns s[i:], cap = len
func SliceStartEnd ¶
SliceStartEnd returns s[i:j], cap = len