types

package
v1.0.31 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: MIT Imports: 7 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotNum = errors.New("not a number")

Functions

func Bytes2Number

func Bytes2Number[T constraints.Integer | constraints.Float](data []byte) T

func FormatFloat

func FormatFloat[T constraints.Float | constraints.Integer](num T, prec int) string

FormatFloat 浮点数格式化成字符串.

func Itoa

func Itoa[T constraints.Integer | constraints.Float](num T) string

Itoa 整数转换成字符串.

func Number2Bytes

func Number2Bytes[T constraints.Integer | constraints.Float](num T) []byte

func ParseFloat

func ParseFloat[T constraints.Float](str string) (T, error)

ParseFloat 字符串转换成浮点数.

func ParseInteger

func ParseInteger[T constraints.Integer](str string) (T, error)

ParseInteger 字符串转换成整数. nolint

func ParseIntegerAny

func ParseIntegerAny[T constraints.Integer](elem any) (T, error)

ParseIntegerAny 任意类型转换成数值. nolint

func Round

func Round[I constraints.Integer, F constraints.Float](float F) I

Round 四舍五入.

Types

This section is empty.

Jump to

Keyboard shortcuts

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