convert

package
v2.0.0-alpha.18 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func B2S

func B2S(b []byte) string

func BtoS

func BtoS(b []byte) (s string)

BtoS converts byte slice to string

func BtoU4

func BtoU4(b []byte) (i []uint32)

BtoU4 converts byte slice to integer slice

func BtoU8

func BtoU8(b []byte) (i []uint64)

BtoU8 converts byte slice to integer slice

func ByteSize

func ByteSize(bytes uint64) string

ByteSize returns a human-readable byte string of the form 10M, 12.5K, and so forth. The unit that results in the smallest number greater than or equal to 1 is always chosen.

func Copy

func Copy(x []byte) []byte

Copy creates an identical copy of x

func CopyBytes

func CopyBytes(b []byte) []byte

CopyBytes copies a slice to make it immutable

func CopyString

func CopyString(s string) string

CopyString copies a string to make it immutable

func Map

func Map[K comparable, S, D any](src map[K]S, convert func(S) D) map[K]D

func MapL

func MapL[A comparable, B any](src []A, convert func(A) B) []B

func S2B

func S2B(s string) []byte

func StoB

func StoB(s string) (b []byte)

StoB converts string to byte slice

func StoU4

func StoU4(s string) (i []uint32)

StoU4 converts string to integer slice

func StoU8

func StoU8(s string) (i []uint64)

StoU8 converts string to integer slice

func ToString

func ToString(arg any, timeFormat ...string) string

ToString Change arg to string

func U4toB

func U4toB(i []uint32) (b []byte)

U4toB converts integer slice to byte slice

func U4toS

func U4toS(i []uint32) (s string)

U4toS converts integer slice to string

func U4toU8

func U4toU8(i []uint32) (k []uint64)

U4toU8 converts uint32 slice to uint64 slice

func U8toB

func U8toB(i []uint64) (b []byte)

U8toB converts integer slice to byte slice

func U8toS

func U8toS(i []uint64) (s string)

U8toS converts integer slice to string

func U8toU4

func U8toU4(i []uint64) (k []uint32)

U8toU4 converts uint64 slice to uint32 slice

Types

type Slice

type Slice struct {
	Data unsafe.Pointer
	Len  int
	Cap  int
}

Slice internals from reflect

type String

type String struct {
	Data unsafe.Pointer
	Len  int
}

String internals from reflect

Jump to

Keyboard shortcuts

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