From 362a83d0c63eda2fde86dd42978c2a7aeb66a5a2 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sat, 23 Jan 2021 09:02:28 +0200 Subject: [PATCH] docs: add an example of zero padding in string interpolation --- doc/docs.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/docs.md b/doc/docs.md index 0bbf37a561..e35debe80c 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -480,8 +480,9 @@ The compiler takes care of the storage size, so there is no `hd` or `llu`. ```v x := 123.4567 println('x = ${x:4.2f}') -println('[${x:10}]') // pad with spaces on the left -println('[${int(x):-10}]') // pad with spaces on the right +println('[${x:10}]') // pad with spaces on the left => [ 123.457] +println('[${int(x):-10}]') // pad with spaces on the right => [123 ] +println('[${int(x):010}]') // pad with zeros on the left => [0000000123] ``` ### String operators