util

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Decode

func Base64Decode(encodedStr string) (string, error)

Base64Decode decodes a Base64 encoded string.

func Base64Encode

func Base64Encode(str string) string

Base64Encode encodes a string using Base64 encoding.

func ConvertKVToNestedMap

func ConvertKVToNestedMap(flatMap []*config.AppConfigKeyValue) map[string]interface{}

func ConvertToNestedMap

func ConvertToNestedMap(flatMap map[string]string) map[string]interface{}

ConvertToNestedMap 接收一个包含点分隔键的 map 并将其转换为嵌套的 map 结构

func FindString

func FindString(arr []string, target string) int

FindString 在字符串切片中查找一个元素,返回索引和是否找到的布尔值

func GetUrlArg

func GetUrlArg(url, request string) string

GetUrlArg extracts a query parameter from a URL string.

func GetUrlArgUnescape

func GetUrlArgUnescape(urlString, request string) string

func HashToString

func HashToString(str string) string

HashToString 模拟 C++ 的 hash_ 和 std::to_string

func IsBase64

func IsBase64(str string) bool

IsBase64 checks if a given string is a valid Base64 standard encoded string.

func IsFileUrl

func IsFileUrl(path string) bool

func IsIPv4

func IsIPv4(address string) bool

IsIPv4 checks if the given address is a valid IPv4 address.

func IsIPv6

func IsIPv6(address string) bool

IsIPv6 checks if the given address is a valid IPv6 address.

func IsLink(path string) bool

func RegFind

func RegFind(src string, match string) bool

func RegGetMatch

func RegGetMatch(src, pattern string, args ...*string) error

RegGetMatch 尝试在 src 中根据给定的正则表达式 pattern 匹配,并将匹配的分组结果赋给可变参数列表中的字符串指针。 如果匹配失败或分组数量与参数数量不匹配,将返回错误。

func RegMatch

func RegMatch(src, pattern string) bool

func RegReplace

func RegReplace(src, match, rep string, multiline bool) string

RegReplace performs regex-based replacements in the provided source string.

func Str2Int

func Str2Int(str string) int

func Str2UInt16

func Str2UInt16(str string) uint16

func StringMapGet

func StringMapGet[T int | int32 | string | bool | float32](m map[string]interface{}, keys ...string) T

func StringMapGetMapValue

func StringMapGetMapValue(m map[string]interface{}, keys ...string) map[string]interface{}

func StringMapSet

func StringMapSet[T int | int32 | string | bool | float32](m map[string]interface{}, value T, keys ...string)

func UrlSafeBase64Decode

func UrlSafeBase64Decode(encodedStr string) (string, error)

UrlSafeBase64Decode decodes a URL-safe Base64 encoded string.

func UrlSafeBase64Encode

func UrlSafeBase64Encode(str string) string

UrlSafeBase64Encode encodes a string using URL-safe Base64 encoding without padding.

Types

This section is empty.

Jump to

Keyboard shortcuts

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