Skip to content

Commit

Permalink
doc: add r and R string interpolation switch examples (#20473)
Browse files Browse the repository at this point in the history
  • Loading branch information
juan-db committed Jan 10, 2024
1 parent 4640627 commit 61cd2ee
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion doc/docs.md
Expand Up @@ -704,6 +704,13 @@ println('[${10.0000:.2}]') // remove insignificant 0s at the end => [10]
println('[${10.0000:.2f}]') // do show the 0s at the end, even though they do not change the number => [10.00]
```

V also has `r` and `R` switches, which will repeat the string the specified amount of times.

```v
println('[${'abc':3r}]') // [abcabcabc]
println('[${'abc':3R}]') // [ABCABCABC]
```

#### String operators

```v
Expand Down Expand Up @@ -7299,4 +7306,4 @@ Assignment Operators
+= -= *= /= %=
&= |= ^=
>>= <<= >>>=
```
```

0 comments on commit 61cd2ee

Please sign in to comment.