0 branches
Tree Top files
Code
Clone with HTTPS:
56 years ago
..
f64_str.c.v all: super_batch3 fixes last Apr 13 10.32 KB
f64_str.v all: unwrap const() blocks 2 years ago 764 bytes
structs.v strconv: vfmt everything 5 years ago 719 bytes
tables.v all: unwrap const() blocks 2 years ago 33.96 KB
utilities.c.v all: fix more tests last Apr 29 6.53 KB
vprintf.c.v all: super_batch6 fixes last Apr 17 16.27 KB

Description

strconv provides functions for converting strings to numbers and numbers to strings.

Buffer formatting

write_dec and write_dec_u write a decimal integer into a caller-provided []u8 buffer. They return the number of bytes written, or -1 when the buffer is too small.

import strconv

mut buf := []u8{len: 20}
n := strconv.write_dec(-12345, mut buf)
assert n == 6
assert buf[..n].bytestr() == '-12345'