]> Cypherpunks repositories - gostls13.git/commitdiff
fmt: add an example for Sprintln
authorDrew Flower <drewvanstone@gmail.com>
Thu, 30 Aug 2018 20:16:45 +0000 (14:16 -0600)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 31 Aug 2018 03:52:48 +0000 (03:52 +0000)
Change-Id: I0fcb5e626bf3d6891592c21b912c824743d7eaa0
Reviewed-on: https://go-review.googlesource.com/132280
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/fmt/example_test.go

index 92d5cd519e543534066dc14dc8a06d542f0ffd0d..1d2cc0d7574c97d3cd812c80558840989e4ed4a8 100644 (file)
@@ -40,6 +40,14 @@ func ExamplePrintln() {
        // 21
 }
 
+func ExampleSprintln() {
+       s := "Aug"
+       sl := fmt.Sprintln("Today is 30", s)
+       fmt.Printf("%q", sl)
+       // Output:
+       // "Today is 30 Aug\n"
+}
+
 func ExampleFprintln() {
        n, err := fmt.Fprintln(os.Stdout, "there", "are", 99, "gophers")
        if err != nil {