From ab162ed3b3156aa665033782841b6ae82162eadd Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Sat, 17 Nov 2012 07:13:57 -0800 Subject: [PATCH] update --- public/string-formatting | 47 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/public/string-formatting b/public/string-formatting index 94706be..be4465d 100644 --- a/public/string-formatting +++ b/public/string-formatting @@ -205,7 +205,7 @@ floats. For basic decimal formatting use %f.

-
    fmt.Printf("%f", 78.9)
+            
    fmt.Printf("%f\n", 78.9)
 
@@ -353,7 +353,7 @@ and returns a string without printing it anywhere.

-
    s := fmt.Sprintf("a %s ", "string")
+            
    s := fmt.Sprintf("a %s", "string")
     fmt.Println(s)
 
@@ -383,29 +383,30 @@ and returns a string without printing it anywhere.

-
$ go run string-formatting.go 
-{1 2} 
-{x:1 y:2} 
-main.point{x:1, y:2} 
-main.point 
-true 
-123 
-1110 
-! 
-1c8 
-78.9000001.234000e+08 
-1.234000E+08 
-"string" 
-"\"string\"" 
-6865782074686973 
-0x42134100 
-|    12|   345| 
-|  1.20|  3.45| 
-|1.20  |3.45  | 
+            
$ go run string-formatting.go
+{1 2}
+{x:1 y:2}
+main.point{x:1, y:2}
+main.point
+true
+123
+1110
+!
+1c8
+78.900000
+1.234000e+08
+1.234000E+08
+"string"
+"\"string\""
+6865782074686973
+0x42135100
+|    12|   345|
+|  1.20|  3.45|
+|1.20  |3.45  |
 |   foo|     b|
 |foo   |b     |
-a string 
-an error 
+a string
+an error