numz

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package numz provides various utilities for working with numbers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustParse

func MustParse[T Number](s string) T

MustParse is like Parse, but panics on error.

func Parse

func Parse[T Number](s string) (T, error)

Parse a number of the given generic type from string using default settings. Note that this method uses reflection.

Types

type Float

type Float interface {
	~float32 | ~float64
}

Float describes floating point numbers.

type Integer

type Integer interface {
	Signed | Unsigned
}

Integer describes signed and unsigned integers.

type Number

type Number interface {
	Integer | Float
}

Number describes a number.

type Signed

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

Signed describes signed integers.

type Unsigned

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

Unsigned describes unsigned integers.

Jump to

Keyboard shortcuts

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