Documentation
¶
Overview ¶
Package strings provides a collection of functions for string manipulation.
This package is a generated adapter and mirrors the public API of the standard Go library's `strings` package. It offers a convenient way to access the rich set of standard string utilities.
For detailed information on the behavior of specific functions, please refer to the official Go documentation for the `strings` package.
Example:
addr := "[INFO] This is a log message." // Check for a prefix _ = strings.HasPrefix(addr, "[INFO]") // true // Trim the prefix msg := strings.TrimPrefix(addr, "[INFO] ") // msg is "This is a log message."
Package strings implements the functions, types, and interfaces for the module.
Package strings contains generated code by adptool.
Package strings implements the functions, types, and interfaces for the module.
Index ¶
- func Clone(s string) string
- func Compare(a, b string) int
- func Contains(s, substr string) bool
- func ContainsAny(s, chars string) bool
- func ContainsFunc(s string, f func(rune) bool) bool
- func ContainsRune(s string, r rune) bool
- func Count(s, substr string) int
- func Cut(s, sep string) (before, after string, found bool)
- func CutPrefix(s, prefix string) (after string, found bool)
- func CutSuffix(s, suffix string) (before string, found bool)
- func EqualFold(s, t string) bool
- func Fields(s string) []string
- func FieldsFunc(s string, f func(rune) bool) []string
- func HasPrefix(s, prefix string) bool
- func HasSuffix(s, suffix string) bool
- func Index(s, substr string) int
- func IndexAny(s, chars string) int
- func IndexByte(s string, c byte) int
- func IndexFunc(s string, f func(rune) bool) int
- func IndexRune(s string, r rune) int
- func Join(elems []string, sep string) string
- func LastIndex(s, substr string) int
- func LastIndexAny(s, chars string) int
- func LastIndexByte(s string, c byte) int
- func LastIndexFunc(s string, f func(rune) bool) int
- func Map(mapping func(rune) rune, s string) string
- func NewReader(s string) *strings.Reader
- func NewReplacer(oldnew ...string) *strings.Replacer
- func ParseOr[T any](s string, def ...T) T
- func Repeat(s string, count int) string
- func Replace(s, old, new string, n int) string
- func ReplaceAll(s, old, new string) string
- func Split(s, sep string) []string
- func SplitAfter(s, sep string) []string
- func SplitAfterN(s, sep string, n int) []string
- func SplitN(s, sep string, n int) []string
- func Title(s string) string
- func ToLower(s string) string
- func ToLowerSpecial(c unicode.SpecialCase, s string) string
- func ToTitle(s string) string
- func ToTitleSpecial(c unicode.SpecialCase, s string) string
- func ToUpper(s string) string
- func ToUpperSpecial(c unicode.SpecialCase, s string) string
- func ToValidUTF8(s, replacement string) string
- func Trim(s, cutset string) string
- func TrimFunc(s string, f func(rune) bool) string
- func TrimLeft(s, cutset string) string
- func TrimLeftFunc(s string, f func(rune) bool) string
- func TrimPrefix(s, prefix string) string
- func TrimRight(s, cutset string) string
- func TrimRightFunc(s string, f func(rune) bool) string
- func TrimSpace(s string) string
- func TrimSuffix(s, suffix string) string
- type Builder
- type Reader
- type Replacer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsAny ¶ added in v0.4.0
func ContainsRune ¶ added in v0.4.0
func LastIndexAny ¶ added in v0.4.0
func LastIndexByte ¶ added in v0.4.0
func NewReplacer ¶ added in v0.4.0
func ParseOr ¶ added in v0.4.0
ParseOr converts a string to a specified type, with support for a default value. It supports all basic types (int/uint variants, float, bool, string) and JSON-deserializable types. If parsing fails and a default value is provided, it returns the default value. If parsing fails and no default is provided, it panics.
func ReplaceAll ¶ added in v0.4.0
func SplitAfter ¶ added in v0.4.0
func SplitAfterN ¶ added in v0.4.0
func ToLowerSpecial ¶ added in v0.4.0
func ToLowerSpecial(c unicode.SpecialCase, s string) string
func ToTitleSpecial ¶ added in v0.4.0
func ToTitleSpecial(c unicode.SpecialCase, s string) string
func ToUpperSpecial ¶ added in v0.4.0
func ToUpperSpecial(c unicode.SpecialCase, s string) string