conv

package
v0.0.0-...-642df0c Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: BSD-3-Clause, MIT Imports: 2 Imported by: 0

README

conv

GoDoc

A Go package for converting various primitive types.

Designed to follow ECMA-262, therefore it differs slightly from how the built in strconv package works.

Please see the docs for more details.

Functions

Ttoi(t bool) int64      // bool -> int64
Ttou(t bool) uint64     // bool -> uint64
Ttof(t bool) float64    // bool -> float64
Ttoa(t bool) string     // bool -> string
Ttov(t bool) any        // bool -> any

Ftot(f float64) bool    // float64 -> bool
Ftoi(f float64) int64   // float64 -> int64
Ftou(f float64) uint64  // float64 -> uint64
Ftoa(f float64) string  // float64 -> string
Ftov(f float64) any     // float64 -> any

Itot(i int64) bool      // int64 -> bool
Itof(i int64) float64   // int64 -> float64
Itou(i int64) uint64    // int64 -> uint64
Itoa(i int64) string    // int64 -> string
Itov(i int64) any       // int64 -> any

Utot(u uint64) bool     // uint64 -> bool
Utof(u uint64) float64  // uint64 -> float64
Utoi(u uint64) int64    // uint64 -> int64
Utoa(u uint64) string   // uint64 -> string
Utov(u uint64) any      // uint64 -> any

Atot(a string) bool     // string -> bool
Atof(a string) float64  // string -> float64
Atoi(a string) int64    // string -> int64
Atou(a string) uint64   // string -> uint64
Atov(a string) any      // string -> any

Vtot(v any) bool        // any -> bool
Vtof(v any) float64     // any -> float64
Vtoi(v any) int64       // any -> int64
Vtou(v any) uint64      // any -> uint64
Vtoa(v any) string      // any -> string

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Atof

func Atof(a string) float64

Atof converts string to float64 For infinte numbers use 'Infinity' or '-Infinity', not 'Inf' or '-Inf'. Returns NaN for invalid syntax

func Atoi

func Atoi(a string) int64

Atoi converts string to int64 Returns 0 for invalid syntax

func Atot

func Atot(a string) bool

Atot converts string to bool Always returns true unless string is empty.

func Atou

func Atou(a string) uint64

Atou converts string to uint64 Returns 0 for invalid syntax

func Atov

func Atov(a string) any

Atov converts string to any

func Ftoa

func Ftoa(f float64) string

Ftoa converts float64 to string Returns 'Infinity' or '-Infinity', not 'Inf' or '-Inf', for infinite numbers. Returns 'NaN' for not-a-number.

func Ftoi

func Ftoi(f float64) int64

Ftoi converts float64 to int64

func Ftot

func Ftot(f float64) bool

Ftot converts float64 to bool

func Ftou

func Ftou(f float64) uint64

Ftou converts float64 to uint64

func Ftov

func Ftov(f float64) any

Ftov converts float64 to any

func Itoa

func Itoa(i int64) string

Itoa converts int64 to string

func Itof

func Itof(i int64) float64

Itof converts int64 to float64

func Itot

func Itot(i int64) bool

Itot converts int64 to bool

func Itou

func Itou(i int64) uint64

Itou converts int64 to uint64

func Itov

func Itov(i int64) any

Itov converts int64 to any

func Ttoa

func Ttoa(t bool) string

Ttoa converts bool to string

func Ttof

func Ttof(t bool) float64

Ttof converts bool to float64

func Ttoi

func Ttoi(t bool) int64

Ttoi converts bool to int64

func Ttou

func Ttou(t bool) uint64

Ttou converts bool to uint64

func Ttov

func Ttov(t bool) any

Ttov converts bool to any

func Utoa

func Utoa(u uint64) string

Utoa converts uint64 to string

func Utof

func Utof(u uint64) float64

Utof converts uint64 to float64

func Utoi

func Utoi(u uint64) int64

Utoi converts uint64 to int64

func Utot

func Utot(u uint64) bool

Itot converts uint64 to bool

func Utov

func Utov(u uint64) any

Utov converts uint64 to any

func Vtoa

func Vtoa(v any) string

Vtoa converts any to string

func Vtof

func Vtof(v any) float64

Vtof converts any to float64

func Vtoi

func Vtoi(v any) int64

Vtoi converts any to int64

func Vtot

func Vtot(v any) bool

Vtot converts any to bool

func Vtou

func Vtou(v any) uint64

Vtou converts any to uint64

Types

This section is empty.

Jump to

Keyboard shortcuts

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