Documentation ¶
Overview ¶
Package number handler like unit cover.
Index ¶
- Constants
- func AnyInt64(v any) int64
- func DecT36(num int) string
- func DecT62(num int) string
- func Factorial(n uint64) uint64
- func NumberClear(s string) string
- func Round(num float64, b int) float64
- func SumQInt(data []int) int
- func SumQueue(data []any) any
- type BitSize
- func (b BitSize) Bit() float64
- func (b BitSize) Byte() float64
- func (b BitSize) Format() (float64, string)
- func (b BitSize) Format2() (float64, string)
- func (b BitSize) GB() float64
- func (b BitSize) GiB() float64
- func (b BitSize) KB() float64
- func (b BitSize) KiB() float64
- func (b BitSize) MB() float64
- func (b BitSize) MiB() float64
- func (b BitSize) PB() float64
- func (b BitSize) PiB() float64
- func (b BitSize) String() string
- func (b BitSize) TB() float64
- func (b BitSize) TiB() float64
- type Decimal
- type Unit
Examples ¶
Constants ¶
const ( Bit BitSize = 1 Byte = 8 * Bit KB = 1000 * Byte //kilobyte MB = 1000 * KB //megabyte GB = 1000 * MB //gigabyte TB = 1000 * GB //terabyte PB = 1000 * TB //petabyte KiB = 1024 * Byte // kibibyte MiB = 1024 * KiB // mebibyte GiB = 1024 * MiB // gibibyte TiB = 1024 * GiB // tebibyte PiB = 1024 * TiB // pebibyte )
1 Bytes = 8Bit byte
1 B = 8Bit byte 字节
1 KB = 1024 Bytes Kilobyte 千字节
1 MB = 1024 KB Megabyte 百万字节 兆
1 GB = 1024 MB Gigabyte 千兆 吉
1 TB = 1024 GB Terabyte 万亿字节 太
1 PB = 1024 TB Petabyte 千万亿字节 拍
1 EB = 1024 PB Exabyte 百亿亿字节 艾
1 ZB = 1024 EB Zettabyte 十万亿亿字节 泽
1 YB = 1024 ZB Yottabyte 一亿亿亿字节 尧
1 BB = 1024 YB Brontobyte
1 NB = 1024 BB NonaByte
1 DB = 1024 NB DoggaByte
const ( // NumberStr 9+26+26+3 NumberStr = "0123456789abcdefghijklmnopkrstuvwxyzABCDEFGHIJKLMNOPKRSTUVWXYZ+-=" // N2 进制类型 N2 = 2 N8 = 8 N16 = 16 N32 = 32 N36 = 36 N62 = 62 )
@Date: 2018/12/12 0012 13:45 @Author: Joshua Conero @Name: 10 进制处理
1k = 1000 thousand/kilo 1M = 1000_000 million 1G = 1000_000_000 billion
Variables ¶
This section is empty.
Functions ¶
func Factorial ¶
Factorial Supports factorial operations on natural numbers `n! = n*(n-1)*(n-2)*...*1`
func NumberClear ¶
NumberClear number string clear like '_' or ','
Types ¶
type BitSize ¶
type BitSize int64
BitSize is a example like `time.Duration` The Bytes unit for resource file.