gstrconv

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidData = errors.New("invalid data")
)

Functions

func Atoi

func Atoi(s string) (i int)

Atoi parses a string into int.

func Atoi64

func Atoi64(s string) (rs int64)

Atoi64 parses a string into int64.

func AtoiCn

func AtoiCn(s string) (rs int64, err error)

类似 strconv.Atoi,但增加支持中文数字。 入参可以是中文数字或阿拉伯数字,如 `一百二十三`,`123`,但不支持混合,如 `一百零1` 则返回错误。 「兆」在不同上下文有歧义,因此只支持解释最大数字为 9_9999_9999_9999 / 9_999_999_999_999 / 九万九千九百九十九亿 九千九百九十九万 九千九百九十九 。 https://en.wikipedia.org/wiki/Chinese_numerals

func ParseDigitFromMixed

func ParseDigitFromMixed(s string) (i int)

ParseDigitFromMixed parses a digit from a string contains 0-9 and non 0-9 chars.

func ParseFloat32

func ParseFloat32(s string) (i float32)

ParseFloat32 parses a string into float32.

Types

This section is empty.

Jump to

Keyboard shortcuts

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