Commit d3b95727 authored by Venil Noronha's avatar Venil Noronha Committed by Ian Lance Taylor

fmt: add an example for Sprintf

Signed-off-by: 's avatarVenil Noronha <veniln@vmware.com>

Change-Id: Ie5f50bc31db1eee11582b70b0e25c726090d4037
Reviewed-on: https://go-review.googlesource.com/132236
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent f882d89b
......@@ -27,3 +27,14 @@ func ExampleStringer() {
fmt.Println(a)
// Output: Gopher (2)
}
func ExampleSprintf() {
i := 30
s := "Aug"
sf := fmt.Sprintf("Today is %d %s", i, s)
fmt.Println(sf)
fmt.Println(len(sf))
// Output:
// Today is 30 Aug
// 15
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment