converter

package
v3.5.6+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package converter 格式, 类型转换包

Index

Constants

View Source
const (
	// B byte
	B = (int64)(1 << (10 * iota))
	// KB kilobyte
	KB
	// MB megabyte
	MB
	// GB gigabyte
	GB
	// TB terabyte
	TB
	// PB petabyte
	PB
)

Variables

This section is empty.

Functions

func ConvertFileSize

func ConvertFileSize(size int64, precision ...int) string

ConvertFileSize 文件大小格式化输出

func IntToBool

func IntToBool(i int) bool

IntToBool int 类型转换为 bool

func MustInt

func MustInt(s string) (n int)

MustInt 将string转换为int, 忽略错误

func MustInt64

func MustInt64(s string) (i int64)

MustInt64 将string转换为int64, 忽略错误

func ShortDisplay

func ShortDisplay(s string, num int) string

ShortDisplay 缩略显示字符串s, 显示长度为num, 缩略的内容用"..."填充

func SliceInt64ToString

func SliceInt64ToString(si []int64) (ss []string)

SliceInt64ToString []int64 转换为 []string

func SliceStringToInt

func SliceStringToInt(ss []string) (si []int)

SliceStringToInt []string 转换为 []int

func SliceStringToInt64

func SliceStringToInt64(ss []string) (si []int64)

SliceStringToInt64 []string 转换为 []int64

func ToBytes

func ToBytes(str string) []byte

ToBytes unsafe 转换, 将 string 转换为 []byte

func ToString

func ToString(p []byte) string

ToString unsafe 转换, 将 []byte 转换为 string

Types

This section is empty.

Jump to

Keyboard shortcuts

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