safe_parse

package
v1.2.40 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseBool

func ParseBool(s string) (v bool, ok bool)

func ParseComplex

func ParseComplex(s string) (v complex128, ok bool)

func ParseComplex64

func ParseComplex64(s string) (v complex64, ok bool)

func ParseFloat32

func ParseFloat32(s string) (v float32, ok bool)

func ParseFloat64

func ParseFloat64(s string) (v float64, ok bool)

func ParseInt

func ParseInt(s string) (v int, ok bool)

func ParseInt16

func ParseInt16(s string) (v int16, ok bool)

func ParseInt32

func ParseInt32(s string) (v int32, ok bool)

func ParseInt64

func ParseInt64(s string) (v int64, ok bool)

func ParseInt8

func ParseInt8(s string) (v int8, ok bool)

func ParseTime

func ParseTime(s string) (v time.Time, ok bool)

func ParseUint

func ParseUint(s string) (v uint, ok bool)

func ParseUint16

func ParseUint16(s string) (v uint16, ok bool)

func ParseUint32

func ParseUint32(s string) (v uint32, ok bool)

func ParseUint64

func ParseUint64(s string) (v uint64, ok bool)

func ParseUint8

func ParseUint8(s string) (v uint8, ok bool)

func ParseUintptr

func ParseUintptr(s string) (v uintptr, ok bool)

Types

type Number

type Number struct {
	// contains filtered or unexported fields
}

Number no precision lose Parse From string if parse invalid field is nil

func ParseNumber

func ParseNumber(s string) (num Number)

ParseNumber a safe Number representation

func (Number) F32

func (n Number) F32() *float32

func (Number) F64

func (n Number) F64() *float64

func (Number) Get

func (n Number) Get(kind reflect.Kind) (v any, ok bool)

Get +param: kind reflect.Int ~ reflect.Float64 +return: v is kind direct value, type: int, uint, float64, ..., etc.

func (Number) I

func (n Number) I() *int

func (Number) I16

func (n Number) I16() *int16

func (Number) I32

func (n Number) I32() *int32

func (Number) I64

func (n Number) I64() *int64

func (Number) I8

func (n Number) I8() *int8

func (Number) S

func (n Number) S() string

func (Number) U

func (n Number) U() *uint

func (Number) U16

func (n Number) U16() *uint16

func (Number) U32

func (n Number) U32() *uint32

func (Number) U64

func (n Number) U64() *uint64

func (Number) U8

func (n Number) U8() *uint8

func (Number) UPtr

func (n Number) UPtr() *uintptr

type Type

type Type interface {
	Bool() bool
	Number() Number
	Time() time.Time
	Text() string
	Get(kind reflect.Kind, kindDesc ...string) (any, bool)
}

func Parse

func Parse(s string) Type

Jump to

Keyboard shortcuts

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