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

all: new string interpolation in pure V (#10181)

This commit is contained in:
penguindark
2021-05-24 04:20:45 +02:00
committed by GitHub
parent 603e57745f
commit d8d05e0106
28 changed files with 2624 additions and 640 deletions

View File

@ -18,8 +18,8 @@ pub fn complex(re f64, im f64) Complex {
// To String method
pub fn (c Complex) str() string {
mut out := '${c.re:f}'
out += if c.im >= 0 { '+${c.im:f}' } else { '${c.im:f}' }
mut out := '${c.re:.6f}'
out += if c.im >= 0 { '+${c.im:.6f}' } else { '${c.im:.6f}' }
out += 'i'
return out
}