strings

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package strings provides a rich collection of functions for string manipulation.

This package is a generated adapter that 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.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clone added in v0.4.0

func Clone(s string) string

func Compare added in v0.4.0

func Compare(a, b string) int

func Contains added in v0.4.0

func Contains(s, substr string) bool

func ContainsAny added in v0.4.0

func ContainsAny(s, chars string) bool

func ContainsFunc added in v0.4.0

func ContainsFunc(s string, f func(rune) bool) bool

func ContainsRune added in v0.4.0

func ContainsRune(s string, r rune) bool

func Count added in v0.4.0

func Count(s, substr string) int

func Cut added in v0.4.0

func Cut(s, sep string) (before, after string, found bool)

func CutPrefix added in v0.4.0

func CutPrefix(s, prefix string) (after string, found bool)

func CutSuffix added in v0.4.0

func CutSuffix(s, suffix string) (before string, found bool)

func EqualFold added in v0.4.0

func EqualFold(s, t string) bool

func Fields added in v0.4.0

func Fields(s string) []string

func FieldsFunc added in v0.4.0

func FieldsFunc(s string, f func(rune) bool) []string

func FieldsFuncSeq added in v0.6.0

func FieldsFuncSeq(s string, f func(rune) bool) iter.Seq[string]

func FieldsSeq added in v0.6.0

func FieldsSeq(s string) iter.Seq[string]

func HasPrefix added in v0.4.0

func HasPrefix(s, prefix string) bool

func HasSuffix added in v0.4.0

func HasSuffix(s, suffix string) bool

func Index added in v0.4.0

func Index(s, substr string) int

func IndexAny added in v0.4.0

func IndexAny(s, chars string) int

func IndexByte added in v0.4.0

func IndexByte(s string, c byte) int

func IndexFunc added in v0.4.0

func IndexFunc(s string, f func(rune) bool) int

func IndexRune added in v0.4.0

func IndexRune(s string, r rune) int

func Join added in v0.4.0

func Join(elems []string, sep string) string

func LastIndex added in v0.4.0

func LastIndex(s, substr string) int

func LastIndexAny added in v0.4.0

func LastIndexAny(s, chars string) int

func LastIndexByte added in v0.4.0

func LastIndexByte(s string, c byte) int

func LastIndexFunc added in v0.4.0

func LastIndexFunc(s string, f func(rune) bool) int

func Lines added in v0.6.0

func Lines(s string) iter.Seq[string]

func Map added in v0.4.0

func Map(mapping func(rune) rune, s string) string

func NewReader added in v0.4.0

func NewReader(s string) *strings.Reader

func NewReplacer added in v0.4.0

func NewReplacer(oldnew ...string) *strings.Replacer

func ParseOr added in v0.4.0

func ParseOr[T any](s string, def ...T) T

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 Repeat added in v0.4.0

func Repeat(s string, count int) string

func Replace added in v0.4.0

func Replace(s, old, new string, n int) string

func ReplaceAll added in v0.4.0

func ReplaceAll(s, old, new string) string

func Split added in v0.4.0

func Split(s, sep string) []string

func SplitAfter added in v0.4.0

func SplitAfter(s, sep string) []string

func SplitAfterN added in v0.4.0

func SplitAfterN(s, sep string, n int) []string

func SplitAfterSeq added in v0.6.0

func SplitAfterSeq(s, sep string) iter.Seq[string]

func SplitN added in v0.4.0

func SplitN(s, sep string, n int) []string

func SplitSeq added in v0.6.0

func SplitSeq(s, sep string) iter.Seq[string]

func Title added in v0.4.0

func Title(s string) string

func ToLower added in v0.4.0

func ToLower(s string) string

func ToLowerSpecial added in v0.4.0

func ToLowerSpecial(c unicode.SpecialCase, s string) string

func ToTitle added in v0.4.0

func ToTitle(s string) string

func ToTitleSpecial added in v0.4.0

func ToTitleSpecial(c unicode.SpecialCase, s string) string

func ToUpper added in v0.4.0

func ToUpper(s string) string

func ToUpperSpecial added in v0.4.0

func ToUpperSpecial(c unicode.SpecialCase, s string) string

func ToValidUTF8 added in v0.4.0

func ToValidUTF8(s, replacement string) string

func Trim added in v0.4.0

func Trim(s, cutset string) string

func TrimFunc added in v0.4.0

func TrimFunc(s string, f func(rune) bool) string

func TrimLeft added in v0.4.0

func TrimLeft(s, cutset string) string

func TrimLeftFunc added in v0.4.0

func TrimLeftFunc(s string, f func(rune) bool) string

func TrimPrefix added in v0.4.0

func TrimPrefix(s, prefix string) string

func TrimRight added in v0.4.0

func TrimRight(s, cutset string) string

func TrimRightFunc added in v0.4.0

func TrimRightFunc(s string, f func(rune) bool) string

func TrimSpace added in v0.4.0

func TrimSpace(s string) string

func TrimSuffix added in v0.4.0

func TrimSuffix(s, suffix string) string

Types

type Builder added in v0.4.0

type Builder = strings.Builder

type Reader added in v0.4.0

type Reader = strings.Reader

type Replacer added in v0.4.0

type Replacer = strings.Replacer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL