converter

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: BSD-3-Clause Imports: 6 Imported by: 4

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 any) []int

ArrInt convert any value to []int.

func ArrInt64

func ArrInt64(v any) []int64

ArrInt64 convert any value to []int64.

func ArrStr

func ArrStr(v any) []string

ArrStr convert any value to []string.

func Bool

func Bool(v any) 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 any) float64

Float64 converts any value to float64

func Int

func Int(v any) int

Int converts any value to int

func Int64

func Int64(v any) 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 any) string

func String

func String(v any) 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