utils

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: GPL-3.0 Imports: 20 Imported by: 2

Documentation

Index

Constants

View Source
const Fractions = "¼½¾⅐⅑⅒⅓⅔⅕⅖⅗⅘⅙⅚⅛⅜⅝⅞"

Variables

This section is empty.

Functions

func AppendUnique

func AppendUnique[E comparable](s []E, v E) []E

func BaseUrl

func BaseUrl(urlStr string) string

func Cleanup

func Cleanup(s string) string

func CleanupInline

func CleanupInline(s string) string

func CleanupLang

func CleanupLang(lang string) string

func Coalesce added in v0.17.0

func Coalesce(dst, src string) string

func Deduplicate

func Deduplicate[E comparable](s []E) []E

func DomainZone

func DomainZone(urlStr string) string

func ExecuteRequest added in v0.16.0

func ExecuteRequest(config RequestConfig, options model.RequestOptions) ([]byte, *url.URL, error)

func FindFloat

func FindFloat(val interface{}) float64

func FindInt

func FindInt(val interface{}) int

func FindNumber

func FindNumber(str string) *float64

func FirstMetaContent added in v0.17.0

func FirstMetaContent(el *goquery.Selection, names ...string) (string, bool)

FirstMetaContent returns the content attribute of the first matching meta-element from a list of identifiers.

func FormatFraction

func FormatFraction(f float64) string

func GetMetaContent added in v0.17.0

func GetMetaContent(el *goquery.Selection, key, name string) (string, bool)

GetMetaContent retrieves the "content" attribute of a meta tag matching the specified key and name in the selection.

func HostAlias

func HostAlias(urlStr string) string

func Hostname

func Hostname(urlStr string) string

func IsAbsolute

func IsAbsolute(urlStr string) bool

func LanguageByDomain

func LanguageByDomain(tld string) (string, bool)

func Parse8601Duration added in v0.3.0

func Parse8601Duration(str string) time.Duration

func ParseDuration

func ParseDuration(str string) (time.Duration, bool)

func ParseFloat

func ParseFloat(str string) (float64, error)

func ParseFraction

func ParseFraction(str string) (float64, error)

func ParseInt

func ParseInt(str string) (int, error)

func RemoveDoubleSpace

func RemoveDoubleSpace(str string) string

func RemoveNewLines

func RemoveNewLines(s string) string

func RemoveSpaces

func RemoveSpaces(s string) string

func RemoveTrailingSlash

func RemoveTrailingSlash(urlStr string) string

func SplitParagraphs

func SplitParagraphs(s string) []string

func SplitTitle

func SplitTitle(title string) []string

func ToAbsoluteUrl

func ToAbsoluteUrl(base *url.URL, urlStr string) string

func TrimZeroWidthSpaces

func TrimZeroWidthSpaces(s string) string

func Unquote

func Unquote(s string) string

func UrlMatchesPathPattern added in v0.17.0

func UrlMatchesPathPattern(rawUrl, pattern string) bool

Types

type RequestConfig added in v0.16.0

type RequestConfig struct {
	Method  string
	URL     string
	Body    io.Reader
	Headers http.Header
}

Jump to

Keyboard shortcuts

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