mfmt

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB int64 = 1 << (iota * 10)
	MB
	GB
	TB
	PB
	EB
)

Variables

This section is empty.

Functions

func BytesSize

func BytesSize(b int64) string

func FormatDuration

func FormatDuration(td time.Duration) (ret string)

__d__h__m__.__s | __µs | __ns

func FormatInt

func FormatInt(num int, base int) string

FormatInt 将整数 n 转换为指定 base(2 到 87 之间)的字符串表示形式

0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%&()*+-;<=>?@[]^_`{|}~
10 digits + 26 lowercase + 26 uppercase + 25 symbols = 87 characters

func FormatIntBase

func FormatIntBase(num int, baseChars string) string

func IntFromBase

func IntFromBase(s string, base int) int

func ParseBytesCount

func ParseBytesCount(s string) int64

支持的单位: "K", "KB", "M", "MB", "G", "GB", "T", "TB", "P", "PB", "E", "EB", "B", "BYTE", "BYTES" 默认 BYTE

func ParseDuration

func ParseDuration(s string) time.Duration

默认单位为毫秒,可识别的单位包括: "w", "week", "weeks", "周", "星期", "d", "day", "days", "天", "h", "hour", "hours", "点", "时", "小时", "m", "min", "minute", "minutes", "分", "分钟", "s", "sec", "second", "seconds", "秒", "ms", "millisecond", "milliseconds", "毫秒", "us", "µs", "微秒", "ns", "纳秒"

func TimeLocalString

func TimeLocalString(t time.Time) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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