util

package
v0.0.0-...-6a6084b Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Hostname = hostname() // nolint

Hostname stores hostname.

Functions

func Abbr

func Abbr(s string, maxLen int, ellipse string) string

Abbreviate 将 string/[]byte 缩略到 maxLen (不包含 ellipse)

func ConvertTimeLayout

func ConvertTimeLayout(layout string) string

ConvertTimeLayout converts date time format in java style to go style.

func Esc

func Esc(s string) string

Esc escapes s to a human readable format.

func FormatTime

func FormatTime(d time.Time, layout string) string

FormatTime 日期转字符串.

func JSONCompact

func JSONCompact(data interface{}) string

JSONCompact compact the JSON encoding of data silently.

func JSONCompactE

func JSONCompactE(data interface{}) (string, error)

JSONCompactE compact the JSON encoding of data.

func ParseTime

func ParseTime(d string, layout string) (time.Time, error)

ParseTime 解析日期转字符串.

func PickFirst

func PickFirst(s string, _ interface{}) string

PickFirst ignores the error and returns s.

func StripAny

func StripAny(s, chars string) string

StripAny strips any Unicode code points in chars are within s.

Types

This section is empty.

Jump to

Keyboard shortcuts

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