atoi

package
v0.0.0-...-5ddd6bb Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Overview

Package atoi provides integer parsing functions optimized specifically for jscan since the parser validates the input before the integer parser is invoked.

WARNING: These functions are not a replacement for strconv.ParseInt or strconv.Atoi because they don't validate the input and assumes valid input instead. The jscan tokenizer is guaranteed to provide only valid values which are only not guaranteed to not overflow.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func I16

func I16[S []byte | string](s S) (n int16, overflow bool)

I16 assumes that s is a valid 16-bit signed or unsigned integer (where only '-' is accepted). Returns (0, true) if the value would overflow.

func I32

func I32[S []byte | string](s S) (n int32, overflow bool)

I32 assumes that s is a valid 32-bit signed or unsigned integer (where only '-' is accepted). Returns (0, true) if the value would overflow.

func I64

func I64[S []byte | string](s S) (n int64, overflow bool)

I64 assumes that s is a valid 64-bit signed or unsigned integer (where only '-' is accepted). Returns (0, true) if the value would overflow.

func I8

func I8[S []byte | string](s S) (n int8, overflow bool)

I8 assumes that s is a valid 8-bit signed or unsigned integer (where only '-' is accepted). Returns (0, true) if the value would overflow.

func U16

func U16[S []byte | string](s S) (n uint16, overflow bool)

U16 assumes that s is a valid unsigned 16-bit integer. Returns (0, true) if the value would overflow.

func U32

func U32[S []byte | string](s S) (n uint32, overflow bool)

U32 assumes that s is a valid unsigned 32-bit integer. Returns (0, true) if the value would overflow.

func U64

func U64[S []byte | string](s S) (n uint64, overflow bool)

U64 assumes that s is a valid unsigned 64-bit integer. Returns (0, true) if the value would overflow.

func U8

func U8[S []byte | string](s S) (n uint8, overflow bool)

U8 assumes that s is a valid unsigned 8-bit integer. Returns (0, true) if the value would overflow.

Types

This section is empty.

Jump to

Keyboard shortcuts

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