Documentation ¶
Overview ¶
Package fmtutil provide some format util functions.
Index ¶
- Constants
- func ArgsWithSpaces(args []any) (message string)
- func DataSize(size uint64) string
- func HowLongAgo(sec int64) string
- func ParseByte(sizeStr string) uint64
- func PrettyJSON(v any) (string, error)
- func SizeToString(size uint64) string
- func StringToByte(sizeStr string) uint64
- func StringsToInts(ss []string) (ints []int, err error)
Constants ¶
View Source
const ( OneKByte = 1024 OneMByte = 1024 * 1024 OneGByte = 1024 * 1024 * 1024 )
data size
Variables ¶
This section is empty.
Functions ¶
func ArgsWithSpaces ¶
ArgsWithSpaces it like Println, will add spaces for each argument
func DataSize ¶
DataSize format bytes number friendly.
Usage:
file, err := os.Open(path) fl, err := file.Stat() fmtSize := DataSize(fl.Size())
func ParseByte ¶
ParseByte converts size string like 1GB/1g or 12mb/12M into an unsigned integer number of bytes
func StringsToInts ¶
StringsToInts string slice to int slice. Deprecated: please use the arrutil.StringsToInts()
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.