Documentation ¶
Overview ¶
* @Author: kamalyes 501893067@qq.com * @Date: 2024-08-03 21:32:26 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-03 13:57:05 * @FilePath: \go-toolbox\pkg\convert\convert.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
Index ¶
- func B2S(b []byte) string
- func B64Decode(s string) ([]byte, error)
- func B64Encode(b []byte) string
- func B64UrlDecode(s string) ([]byte, error)
- func B64UrlEncode(b []byte) string
- func Base64ToByte(imageBase64 string) ([]byte, error)
- func ByteToBinStr(b byte) string
- func BytesBCC(data []byte) byte
- func BytesToBinStr(bs []byte) string
- func BytesToBinStrWithSplit(bs []byte, split string) string
- func BytesToHex(data []byte) string
- func ConvertToInt(v interface{}) (int, error)
- func DecToBin(n uint64) string
- func DecToHex(n uint64) string
- func HexBCC(hexStr string) (string, error)
- func HexToBin(h string) (string, error)
- func HexToBytes(hexStr string) ([]byte, error)
- func HexToDec(h string) (uint64, error)
- func MustBool(v interface{}) bool
- func MustInt(v interface{}) (int, error)
- func MustJSON(v interface{}) ([]byte, error)
- func MustJSONIndent(v interface{}) ([]byte, error)
- func MustString(v interface{}, timeLayout ...string) string
- func S2B(s string) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func B2S ¶
B2S converts byte slice to string without a memory allocation. Slower: unsafe.String(unsafe.SliceData(b), len(b)) strings.Clone(): unsafe.String(&b[0], len(b))
func Base64ToByte ¶
Base64ToByte 将 Base64 字符串解码为字节切片 参数:imageBase64 - 要解码的 Base64 字符串 返回:解码后的字节切片和可能的错误
func BytesToBinStrWithSplit ¶
BytesToBinStrWithSplit 将字节数组转为二进制字符串,并添加分隔符
func MustJSONIndent ¶
MustJSONIndent 转 json 返回 []byte
func S2B ¶
S2B converts string to byte slice without a memory allocation. Ref: https://github.com/golang/go/issues/53003#issuecomment-1140276077
Types ¶
This section is empty.