str

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Array2Str

func Array2Str(s interface{}) string

数组转字符串 逗号分割

func CopyFields

func CopyFields(a interface{}, b interface{}, fields ...string) (err error)

用b的所有字段覆盖a的 如果fields不为空, 表示用b的特定字段覆盖a的 a应该为结构体指针

func FromBytes

func FromBytes(bytes []byte) string

FromBytes converts the specified byte array to a string.

func GbkAsUtf8

func GbkAsUtf8(str string) string

func GetBase64ByFile

func GetBase64ByFile(path string) (string, error)

func GetRandomString

func GetRandomString(lens int) string

生成随机字符串

func IsContain

func IsContain(items []string, item string) bool

判断字符串是否在数组里

func IsEmail

func IsEmail(b []byte) bool

func JobKey

func JobKey(taskId, serverId int) int

func LCS

func LCS(s1 string, s2 string) string

LCS gets the longest common substring of s1 and s2.

Refers to http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Longest_common_substring.

func Md5

func Md5(buf []byte) string

func SetPassword

func SetPassword(len int, pwdO string) (pwd string, salt string)

func Struct2Map

func Struct2Map(obj interface{}) map[string]interface{}

结构体转map gorm Updates不会更新结构体里的0及空,需转换成map 此方法不适用此情景,更新为Struct2MapByTag

func Struct2MapByTag

func Struct2MapByTag(obj interface{}, tagName string) map[string]interface{}

func ToBytes

func ToBytes(str string) []byte

Bytes converts the specified str to a byte array.

Types

This section is empty.

Jump to

Keyboard shortcuts

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