stringhelper

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: Apache-2.0 Imports: 3 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append[B ~byte, S1 ~string, S2 String[B]](s S1, more ...S2) S1

Append string data to typed string

func Convert

func Convert[R ~string, B ~byte, S String[B]](s S) R

Convert String to typed string by sharing underlaying data

func HasPrefix

func HasPrefix[B1, B2 ~byte, S1 String[B1], S2 String[B2]](s S1, prefix S2) bool

func HasSuffix

func HasSuffix[B1, B2 ~byte, S1 String[B1], S2 String[B2]](s S1, suffix S2) bool

func Reverse

func Reverse[B ~byte, S String[B]](s S) S

Reverse string s in runes

func SliceEnd

func SliceEnd[B ~byte, S String[B]](s S, i int) S

SliceEnd returns s[:i], cap = len

func SliceStart

func SliceStart[B ~byte, S String[B]](s S, i int) S

SliceStart returns s[i:], cap = len

func SliceStartEnd

func SliceStartEnd[B ~byte, S String[B]](s S, i, j int) S

SliceStartEnd returns s[i:j], cap = len

func ToBytes

func ToBytes[R, B ~byte, S String[B]](s S) []R

ToBytes converts String to typed/untyped byte slice by sharing underlaying data

func TrimPrefix

func TrimPrefix[B1, B2 ~byte, S1 String[B1], S2 String[B2]](s S1, prefix S2) S1

func TrimSuffix

func TrimSuffix[B1, B2 ~byte, S1 String[B1], S2 String[B2]](s S1, suffix S2) S1

Types

type ByteString

type ByteString String[byte]

type String

type String[T ~byte] interface {
	~string | ~[]T
}

Jump to

Keyboard shortcuts

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