strconv #

Constants #

const (
	single_plus_zero      = u32(00x00000000)
	single_minus_zero     = u32(00x80000000)
	single_plus_infinity  = u32(00x7F800000)
	single_minus_infinity = u32(00xFF800000)

	digits                = 18
	double_plus_zero      = u64(0x0000000000000000)
	double_minus_zero     = u64(0x8000000000000000)
	double_plus_infinity  = u64(0x7FF0000000000000)
	double_minus_infinity = u64(0xFFF0000000000000)

	parser_ok             = 0
	parser_pzero          = 1
	parser_mzero          = 2
	parser_pinf           = 3
	parser_minf           = 4

	c_dpoint              = `.`
	c_plus                = `+`
	c_minus               = `-`
	c_zero                = `0`
	c_nine                = `9`
	c_ten                 = u32(10)
)

fn atof64 #

fn atof64(s string) f64

atof64 return a f64 from a string doing a parsing operation

fn atof_quick #

fn atof_quick(s string) f64

atof_quick return a f64 number from a string in a quick way

fn atoi #

fn atoi(s string) ?int

atoi is equivalent to parse_int(s, 10, 0), converted to type int.

fn byte_to_lower #

fn byte_to_lower(c byte) byte

fn common_parse_int #

fn common_parse_int(_s string, base int, _bit_size int, error_on_non_digit bool, error_on_high_digit bool) ?i64

common_parse_int is called by parse int and allows the parsing to stop on non or invalid digit characters and return with an error

fn common_parse_uint #

fn common_parse_uint(s string, _base int, _bit_size int, error_on_non_digit bool, error_on_high_digit bool) ?u64

common_parse_uint is called by parse_uint and allows the parsing to stop on non or invalid digit characters and return with an error

fn common_parse_uint2 #

fn common_parse_uint2(s string, _base int, _bit_size int) (u64, int)

the first returned value contains the parsed value, the second returned value contains the error code (0 = OK, >1 = index of first non-parseable character + 1, -1 = wrong base, -2 = wrong bit size, -3 = overflow)

fn dec_digits #

fn dec_digits(n u64) int

dec_digits return the number of decimal digit of an u64

fn f32_to_str #

fn f32_to_str(f f32, n_digit int) string

f32_to_str return a string in scientific notation with max n_digit after the dot

fn f32_to_str_l #

fn f32_to_str_l(f f32) string

TODO: Investigate precision issues f32_to_str_l return a string with the f32 converted in a string in decimal notation

fn f32_to_str_l_no_dot #

fn f32_to_str_l_no_dot(f f32) string

fn f32_to_str_pad #

fn f32_to_str_pad(f f32, n_digit int) string

f32_to_str return a string in scientific notation with max n_digit after the dot

fn f64_to_str #

fn f64_to_str(f f64, n_digit int) string

f64_to_str return a string in scientific notation with max n_digit after the dot

fn f64_to_str_l #

fn f64_to_str_l(f f64) string

fn f64_to_str_l_no_dot #

fn f64_to_str_l_no_dot(f f64) string

fn f64_to_str_lnd1 #

fn f64_to_str_lnd1(f f64, dec_digit int) string

fn f64_to_str_pad #

fn f64_to_str_pad(f f64, n_digit int) string

f64_to_str return a string in scientific notation with max n_digit after the dot

fn format_dec_old #

fn format_dec_old(d u64, p BF_param) string

max int64 9223372036854775807

fn format_dec_sb #

fn format_dec_sb(d u64, p BF_param, mut res strings.Builder)

format_dec_sb format a u64

fn format_es #

fn format_es(f f64, p BF_param) string

fn format_es_old #

fn format_es_old(f f64, p BF_param) string

fn format_fl #

fn format_fl(f f64, p BF_param) string

strings.Builder version of format_fl

fn format_fl_old #

fn format_fl_old(f f64, p BF_param) string

strings.Builder version of format_fl

fn format_int #

fn format_int(n i64, radix int) string

fn format_str #

fn format_str(s string, p BF_param) string

fn format_str_sb #

fn format_str_sb(s string, p BF_param, mut sb strings.Builder)

strings.Builder version of format_str

fn format_uint #

fn format_uint(n u64, radix int) string

format_uint returns the string representation of the number n in base radix for digit values > 10, this function uses the small latin leters a-z.

fn ftoa_32 #

fn ftoa_32(f f32) string

fn ftoa_64 #

fn ftoa_64(f f64) string

fn ftoa_long_32 #

fn ftoa_long_32(f f32) string

fn ftoa_long_64 #

fn ftoa_long_64(f f64) string

fn fxx_to_str_l_parse #

fn fxx_to_str_l_parse(s string) string

f64_to_str_l return a string with the f64 converted in a string in decimal notation

fn fxx_to_str_l_parse_no_dot #

fn fxx_to_str_l_parse_no_dot(s string) string

f64_to_str_l return a string with the f64 converted in a string in decimal notation

fn parse_int #

fn parse_int(_s string, base int, _bit_size int) ?i64

parse_int interprets a string s in the given base (0, 2 to 36) and bit size (0 to 64) and returns the corresponding value i.

If the base argument is 0, the true base is implied by the string's prefix: 2 for "0b", 8 for "0" or "0o", 16 for "0x", and 10 otherwise.
Also, for argument base 0 only, underscore characters are permitted as defined by the Go syntax for integer literals.

The bitSize argument specifies the integer type that the result must fit into. Bit sizes 0, 8, 16, 32, and 64 correspond to int, int8, int16, int32, and int64.
If bitSize is below 0 or above 64, an error is returned.

fn parse_uint #

fn parse_uint(s string, _base int, _bit_size int) ?u64

parse_uint is like parse_int but for unsigned numbers.

fn remove_tail_zeros #

fn remove_tail_zeros(s string) string

fn remove_tail_zeros_old #

fn remove_tail_zeros_old(s string) string

fn v_printf #

fn v_printf(str string, pt ...voidptr)

fn v_sprintf #

fn v_sprintf(str string, pt ...voidptr) string

fn (Dec32) get_string_32 #

fn (d Dec32) get_string_32(neg bool, i_n_digit int, i_pad_digit int) string

max 46 char -3.40282346638528859811704183484516925440e+38

enum Align_text #

enum Align_text {
	right = 0
	left
	center
}

struct BF_param #

struct BF_param {
pub mut:
	pad_ch       byte = byte(` `)
	len0         int  = -1
	len1         int  = 6
	positive     bool = true
	sign_flag    bool
	allign       Align_text = .right
	rm_tail_zero bool
}

max float 1.797693134862315708145274237317043567981e+308

struct Float32u #

union Float32u {
pub mut:
	f f32
	u u32
}

struct Float64u #

union Float64u {
pub mut:
	f f64
	u u64
}

struct PrepNumber #

struct PrepNumber {
pub mut:
	negative bool
	exponent int
	mantissa u64
}

The structure is filled by parser, then given to converter.