util

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MulanPSL-2.0 Imports: 10 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToStr

func BytesToStr(bytes []byte) string

BytesToStr 快速转换 []byte 为 string。

func ContainsStr added in v1.7.7

func ContainsStr(str string, strs []string) bool

func DomAttrValue added in v1.7.5

func DomAttrValue(n *html.Node, attrName string) string

func DomAttrValuesWithPrefix added in v1.7.7

func DomAttrValuesWithPrefix(n *html.Node, prefix string) (ret map[string]string)

func DomChildByTypeAndClass added in v1.7.7

func DomChildByTypeAndClass(n *html.Node, dataAtom atom.Atom, class ...string) *html.Node

func DomChildrenByType added in v1.7.7

func DomChildrenByType(n *html.Node, dataAtom atom.Atom) (ret []*html.Node)

func DomCustomAttrs added in v1.7.6

func DomCustomAttrs(n *html.Node) (ret map[string]string)

func DomExistChildByType added in v1.7.7

func DomExistChildByType(n *html.Node, dataAtom ...atom.Atom) bool

func DomHTML added in v1.7.5

func DomHTML(n *html.Node) []byte

func DomTexhtml added in v1.7.7

func DomTexhtml(n *html.Node) string

func DomText added in v1.7.5

func DomText(n *html.Node) string

func ExistDomAttr added in v1.7.7

func ExistDomAttr(n *html.Node, attrName string) bool

func GetFormula added in v1.7.7

func GetFormula(n *html.Node) string

func GetTextMarkAData added in v1.7.5

func GetTextMarkAData(n *html.Node) (href, title string)

func GetTextMarkBlockRefData added in v1.7.5

func GetTextMarkBlockRefData(n *html.Node) (id, subtype string)

func GetTextMarkFileAnnotationRefData added in v1.7.5

func GetTextMarkFileAnnotationRefData(n *html.Node) (id string)

func GetTextMarkInlineMathData added in v1.7.5

func GetTextMarkInlineMathData(n *html.Node) (content string)

func GetTextMarkInlineMemoData added in v1.7.5

func GetTextMarkInlineMemoData(n *html.Node) (content string)

func GetTextMarkTextData added in v1.7.5

func GetTextMarkTextData(n *html.Node) (content string)

func GetTextMarkTextDataWithoutEscapeQuote added in v1.7.7

func GetTextMarkTextDataWithoutEscapeQuote(n *html.Node) (content string)

func IsDigit added in v1.7.7

func IsDigit(str string) bool

func IsDocIAL

func IsDocIAL(tokens []byte) bool

func IsDocIAL2

func IsDocIAL2(ial [][]string) bool

func IsEmptyStr added in v1.7.7

func IsEmptyStr(str string) bool

func IsTempMarkSpan added in v1.7.6

func IsTempMarkSpan(n *html.Node) bool

func ParseHTML added in v1.7.7

func ParseHTML(htmlStr string) *html.Node

func PathEscape

func PathEscape(s string) string

PathEscape escapes the string so it can be safely placed inside a URL path segment.

func PathUnescape

func PathUnescape(s string) (string, error)

PathUnescape does the inverse transformation of PathEscape, converting each 3-byte encoded substring of the form "%AB" into the hex-decoded byte 0xAB. It returns an error if any % is not followed by two hexadecimal digits.

PathUnescape is identical to QueryUnescape except that it does not unescape '+' to ' ' (space).

func RecoverPanic

func RecoverPanic(err *error)

RecoverPanic recovers a panic.

func RemoveDomAttr added in v1.7.7

func RemoveDomAttr(n *html.Node, attrName string)

func RemoveDomAttrs added in v1.7.7

func RemoveDomAttrs(n *html.Node)

func SetDomAttrValue added in v1.7.7

func SetDomAttrValue(n *html.Node, attrName, attrVal string)

func StrToBytes

func StrToBytes(str string) []byte

StrToBytes 快速转换 string 为 []byte。

func WordCount

func WordCount(str string) (runeCount, wordCount int)

Types

type EscapeError

type EscapeError string

func (EscapeError) Error

func (e EscapeError) Error() string

type InvalidHostError

type InvalidHostError string

func (InvalidHostError) Error

func (e InvalidHostError) Error() string

Jump to

Keyboard shortcuts

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