str

package
v0.0.49 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlphanumericNum

func AlphanumericNum(s string) int

AlphanumericNum returns the alphanumeric number based on the ASCII code value. AlphanumericNum should be used first because it has a better performance than AlphanumericNumV2 and AlphanumericNumRegExp.

func AlphanumericNumRegExp

func AlphanumericNumRegExp(s string) int

AlphanumericNumRegExp returns the alphanumeric number based on regular expression. Note that this function has a poor performance when compared to AlphanumericNum, so the AlphanumericNum is recommended.

func AlphanumericNumV2

func AlphanumericNumV2(s string) int

AlphanumericNumV2 returns the alphanumeric number based on the ASCII code value. Because range by rune so the performance is worse than AlphanumericNum.

func Join

func Join(a any, sep string) string

Join concatenates all elements of Array, Slice or String to a single string with a separator.

func JoinE

func JoinE(a any, sep string) (string, error)

JoinE concatenates all elements of Array, Slice or String to a single string with a separator and returns an error if an error occurred. E.g. input []int{1, 2, 3} and separator ",", output is a string "1,2,3". It panics if a's Kind is not Array, Slice, or String.

func JoinNonEmptyStrs

func JoinNonEmptyStrs(sep string, s ...string) string

JoinNonEmptyStrs concatenates multiple strings to a single string with the specified separator and skips the empty string.

func Reverse

func Reverse(s string) string

Reverse reverses string without modifying the original string.

func Split

func Split(s, sep string) []string

Split replaces std lib strings.Split. strings.Split has a giant pit because strings.Split ("", ",") will return a slice with an empty string.

func SplitSeps

func SplitSeps(s string, seps ...string) []string

SplitSeps splits string into substring slice by multiple string separators. If you want to specify multiple string separators by regexp, please refer to `func (*Regexp) Split` in standard library regexp package.

Types

This section is empty.

Jump to

Keyboard shortcuts

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