convert

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: MPL-2.0 Imports: 11 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToString

func BytesToString(b []byte) string

BytesToString converts byte slice to text without a memory allocation.

func CsvToInt32s

func CsvToInt32s(s string) []int32

CsvToInt32s 将逗号分隔的string尝试转换成[1,2,3...]的int32 slice Csv means Comma Separated Value

func CsvToInt64s

func CsvToInt64s(s string) []int64

CsvToInt64s 将逗号分隔的string尝试转换成[1,2,3...]的int64 slice Csv means Comma Separated Value

func CsvToInts

func CsvToInts(s string) []int

CsvToInts 将逗号分隔的string尝试转换成[1,2,3...]的int slice Csv means Comma Separated Value

func Int32sToCsv

func Int32sToCsv(int32s []int32) string

Int32sToCsv 将int32 slice转换成用逗号分隔的字符串: 1,2,3

func Int64sToCsv

func Int64sToCsv(int64s []int64) string

Int64sToCsv 将int64 slice转换成用逗号分隔的字符串: 1,2,3

func StringToBytes

func StringToBytes(s string) []byte

StringToBytes converts text to byte slice without a memory allocation.

func ToBytes

func ToBytes(value any) ([]byte, error)

func ToCamelCase

func ToCamelCase(s string) string

ToCamelCase converts from underscore separated form to camel case form.

func ToInt32s

func ToInt32s(strSlice []string) []int32

ToInt32s 将string slice转换成[1,2,3...]的int32 slice

func ToInt64s

func ToInt64s(strSlice []string) []int64

ToInt64s 将string slice转换成[1,2,3...]的int64 slice

func ToInts

func ToInts(strSlice []string) []int

ToInts 将string slice转换成[1,2,3...]的int slice

func ToSlice

func ToSlice(data any) []any

ToSlice 将传过来的数据转换成[]any

func ToSnakeCase

func ToSnakeCase(s string) string

ToSnakeCase converts from camel case form to underscore separated form.

func ToString

func ToString(value any) (string, error)

ToString 尝试将值转换成字符串

Types

type Utils

type Utils interface {
	StringToBytes(s string) []byte
	BytesToString(b []byte) string
	ToString(value any) (string, error)
	ToBytes(value any) ([]byte, error)
	CsvToInt64s(strValue string) []int64
	CsvToInt32s(strValue string) []int32
	CsvToInts(strValue string) []int
	Int64sToCsv(int64s []int64) string
	Int32sToCsv(int32s []int32) string
	ToInt64s(strSlice []string) []int64
	ToInt32s(strSlice []string) []int32
	ToInts(strSlice []string) []int
	ToCamelCase(str string) string
	ToSnakeCase(s string) string
	ToSlice(data any) []any
}

Jump to

Keyboard shortcuts

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