package strconv

import "github.com/tdewolff/parse/v2/strconv"

Index

Functions

func AppendFloat

func AppendFloat(b []byte, f float64, prec int) ([]byte, bool)

AppendFloat appends a float to `b` with precision `prec`. It returns the new slice and whether successful or not. Precision is the number of decimals to display, thus prec + 1 == number of significant digits.

func AppendPrice

func AppendPrice(b []byte, price int64, dec bool, milSeparator byte, decSeparator byte) []byte

AppendPrice will append an int64 formatted as a price, where the int64 is the price in cents. It does not display whether a price is negative or not.

func LenInt

func LenInt(i int64) int

LenInt returns the written length of an integer.

func ParseDecimal

func ParseDecimal(b []byte) (float64, int)

func ParseFloat

func ParseFloat(b []byte) (float64, int)

ParseFloat parses a byte-slice and returns the float it represents. If an invalid character is encountered, it will stop there.

func ParseInt

func ParseInt(b []byte) (int64, int)

ParseInt parses a byte-slice and returns the integer it represents. If an invalid character is encountered, it will stop there.

func ParseUint

func ParseUint(b []byte) (uint64, int)

ParseUint parses a byte-slice and returns the integer it represents. If an invalid character is encountered, it will stop there.

Source Files

decimal.go float.go int.go price.go

Version
v2.6.8
Published
Sep 4, 2023
Platform
js/wasm
Imports
1 packages
Last checked
3 hours ago

Tools for package owners.