normal

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes2String

func Bytes2String(b []byte) string

bytes 转换 string

func BytesCombine

func BytesCombine(pBytes ...[]byte) []byte

merger []byte to single one

func ConvertToUtf8 added in v1.6.0

func ConvertToUtf8(str string) string

将字符编码转换为utf-8

func Equal

func Equal(a, b string) bool

Equal reports whether `a` and `b`, interpreted as UTF-8 strings, are equal under Unicode case-folding, case-insensitively.

func InArray

func InArray(element string, arr []string) bool

判断某个字符串元素是否在数组内

func InArrayInt added in v1.6.1

func InArrayInt(element int, arr []int) bool

判断某个int元素是否在数组内

func InArrayInt64 added in v1.6.1

func InArrayInt64(element int64, arr []int64) bool

判断某个int64元素是否在数组内

func Join

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

Join concatenates the elements of `array` to create a single string. The separator string `sep` is placed between elements in the resulting string.

func RemoveDuplication_map added in v1.6.0

func RemoveDuplication_map(arr []string) []string

数组去重--非排序数组

func RemoveDuplication_sort added in v1.6.0

func RemoveDuplication_sort(arr []string) []string

数组去重--排序数组

func SortMap

func SortMap(params map[string]any) map[string]any

对集合按字母顺序排序

func Split

func Split(str, delimiter string) []string

Split splits string `str` by a string `delimiter`, to an array.

func SplitAndTrim

func SplitAndTrim(str, delimiter string, characterMask ...string) []string

SplitAndTrim splits string `str` by a string `delimiter` to an array, and calls Trim to every element of this array. It ignores the elements which are empty after Trim.

func String2Bytes

func String2Bytes(s string) []byte

string 转换 bytes

func SubByte

func SubByte(p []byte, start, length int) []byte

截取字符数组 如果 start 是非负数,返回的字符串将从 string 的 start 位置开始,从 0 开始计算。例如,在字符串 “abcdef” 中,在位置 0 的字符是 “a”,位置 2 的字符串是 “c” 等等。 如果 start 是负数,返回的字符串将从 string 结尾处向前数第 start 个字符开始。 如果 string 的长度小于 start,将返回空字符串。

如果提供了正数的 length,返回的字符串将从 start 处开始最多包括 length 个字符(取决于 string 的长度)。 如果提供了负数的 length,那么 string 末尾处的 length 个字符将会被省略(若 start 是负数则从字符串尾部算起)。如果 start 不在这段文本中,那么将返回空字符串。 如果提供了值为 0 的 length,返回的子字符串将从 start 位置开始直到字符串结尾。

func SubStr

func SubStr(s string, start, length int) string

截取普通字符串 如果 start 是非负数,返回的字符串将从 string 的 start 位置开始,从 0 开始计算。例如,在字符串 “abcdef” 中,在位置 0 的字符是 “a”,位置 2 的字符串是 “c” 等等。 如果 start 是负数,返回的字符串将从 string 结尾处向前数第 start 个字符开始。 如果 string 的长度小于 start,将返回空字符串。

如果提供了正数的 length,返回的字符串将从 start 处开始最多包括 length 个字符(取决于 string 的长度)。 如果提供了负数的 length,那么 string 末尾处的 length 个字符将会被省略(若 start 是负数则从字符串尾部算起)。如果 start 不在这段文本中,那么将返回空字符串。 如果提供了值为 0 的 length,返回的子字符串将从 start 位置开始直到字符串结尾。

func Trim

func Trim(str string, characterMask ...string) string

Trim strips whitespace (or other characters) from the beginning and end of a string. The optional parameter `characterMask` specifies the additional stripped characters.

Types

This section is empty.

Jump to

Keyboard shortcuts

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