converter

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: BSD-3-Clause Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	BYTE = 1 << (10 * iota)
	KILOBYTE
	MEGABYTE
	GIGABYTE
	TERABYTE
	PETABYTE
	EXABYTE
)

Variables

This section is empty.

Functions

func ArrInt

func ArrInt(v interface{}) []int

ArrInt convert any value to []int.

func ArrInt64

func ArrInt64(v interface{}) []int64

ToArrInt64 convert any value to []int64.

func ArrStr

func ArrStr(v interface{}) []string

ToArrStr convert any value to []string.

func Bool

func Bool(v interface{}) bool

Bool convert any value to boolean.

func ByteSize

func ByteSize(bytes uint64) string

ByteSize returns a human-readable byte string of the form 10M, 12.5K, and so forth. The following units are available:

E: Exabyte
P: Petabyte
T: Terabyte
G: Gigabyte
M: Megabyte
K: Kilobyte
B: Byte

The unit that results in the smallest number greater than or equal to 1 is always chosen.

func Bytes

func Bytes(s string) (uint64, error)

Bytes parses a string formatted by ByteSize as bytes. Note binary-prefixed and SI prefixed units both mean a base-2 units KB = K = KiB = 1024 MB = M = MiB = 1024 * K GB = G = GiB = 1024 * M TB = T = TiB = 1024 * G PB = P = PiB = 1024 * T EB = E = EiB = 1024 * P

func Float64

func Float64(v interface{}) float64

Float64 converts any value to float64

func Int

func Int(v interface{}) int

Int converts any value to int

func Int64

func Int64(v interface{}) int64

Int64 converts any value to int64

func Megabytes

func Megabytes(s string) (uint64, error)

Megabytes parses a string formatted by ByteSize as megabytes.

func Ordinal

func Ordinal(x int) string

Ordinal get ordinal 1st, 2nd, 3rd, etc.

func Percentage

func Percentage(a, b interface{}) string

func String

func String(v interface{}) string

String converts any value to string.

func ToRoman

func ToRoman(number int) string

ToRoman converts your integer to roman format.

Types

This section is empty.

Jump to

Keyboard shortcuts

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