1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builtin: string interpolation: binary format support (#11421)

This commit is contained in:
penguindark
2021-09-06 23:12:54 +02:00
committed by GitHub
parent fae0f8d821
commit bd10a63839
4 changed files with 52 additions and 5 deletions

View File

@ -252,6 +252,10 @@ fn (data StrIntpData) get_fmt_format(mut sb strings.Builder) {
}
strconv.format_dec_sb(abs64(d), bf, mut sb)
} else {
// binary, we use 3 for binary
if base == 3 {
base = 2
}
mut hx := strconv.format_int(d, base)
if upper_case {
tmp := hx
@ -287,6 +291,10 @@ fn (data StrIntpData) get_fmt_format(mut sb strings.Builder) {
}
strconv.format_dec_sb(d, bf, mut sb)
} else {
// binary, we use 3 for binary
if base == 3 {
base = 2
}
mut hx := strconv.format_uint(d, base)
if upper_case {
tmp := hx